rem: virtual void        resizeEvent(QResizeEvent*)    { arrange(); }
add: void SpinBox2::resizeEvent(QResizeEvent* e) { QSpinBox::resizeEvent(e); #if QT_VERSION >= 300 if (!updown2) return;  QRect spinbox(QPoint(0, 0), size()); QRect edit = editor()->geometry(); int margin = spinbox.right() - upRect().right(); spinbox.setLeft(spinbox.left() + (spinbox.right() - edit.right() - edit.left())); updown2->setGeometry(margin, 0, margin + upRect().right(), height() - 1); QSpinBox::setGeometry(spinbox); #else if (!up2 || !down2) return;  QSize bs = upButton()->size(); if (bs != up2->size()) { up2->resize(bs); down2->resize(bs); up2->setPixmap(*upButton()->pixmap()); down2->setPixmap(*downButton()->pixmap()); } int margin = width() - upButton()->x() - bs.width(); QRect edit = editor()->geometry(); edit.setLeft(edit.left() + bs.width()); editor()->setGeometry(edit); QRect frame = frameRect(); if (frame.right() != width()) { frame.setLeft(frame.left() + bs.width()); setFrameRect(frame); } up2->move(margin, upButton()->y()); down2->move(margin, downButton()->y()); #endif }
context: 		virtual void        resizeEvent(QResizeEvent*)    { arrange(); }