- Timestamp:
- Apr 18, 2007 1:09:20 PM (18 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/include/VBoxGlobal.h
r2044 r2170 134 134 }; 135 135 136 class QIConstrainKeeper : public QObject 137 { 138 Q_OBJECT 139 140 public: 141 142 QIConstrainKeeper (QWidget*); 143 144 private: 145 146 bool eventFilter (QObject*, QEvent*); 147 }; 148 136 149 // VBoxGlobal 137 150 //////////////////////////////////////////////////////////////////////////////// -
trunk/src/VBox/Frontends/VirtualBox/src/VBoxGlobal.cpp
r2158 r2170 470 470 471 471 #endif /* Q_WS_WIN */ 472 473 // QIConstrainKeeper 474 //////////////////////////////////////////////////////////////////////////////// 475 476 QIConstrainKeeper::QIConstrainKeeper (QWidget *aParent) : QObject (aParent) 477 { 478 aParent->setMinimumSize (aParent->size()); 479 aParent->installEventFilter (this); 480 } 481 482 bool QIConstrainKeeper::eventFilter (QObject *aObject, QEvent *aEvent) 483 { 484 if (aObject == parent() && aEvent->type() == QEvent::Resize) 485 { 486 QResizeEvent *ev = static_cast<QResizeEvent*> (aEvent); 487 QSize oldSize = ev->oldSize(); 488 QSize newSize = ev->size(); 489 int maxWidth = newSize.width() > oldSize.width() ? 490 newSize.width() : oldSize.width(); 491 int maxHeight = newSize.height() > oldSize.height() ? 492 newSize.height() : oldSize.height(); 493 if (maxWidth > oldSize.width() || maxHeight > oldSize.height()) 494 ((QWidget*)parent())->setMinimumSize (maxWidth, maxHeight); 495 } 496 return QObject::eventFilter (aObject, aEvent); 497 } 472 498 473 499 // VBoxGlobal … … 1945 1971 else 1946 1972 loadOk = false; 1947 1973 1948 1974 if (loadOk) 1949 1975 sLoadedLangId = selectedLangId; -
trunk/src/VBox/Frontends/VirtualBox/src/VBoxSelectorWnd.cpp
r2139 r2170 980 980 break; 981 981 } 982 case QEvent::Show: 983 { 984 /* Constrain StartVM button size */ 985 QObjectList *list = queryList ("QToolButton", 986 QString (vmStartAction->name()) + "_action_button"); 987 QToolButton *actionButton = list->first() ? 988 static_cast<QToolButton*> (list->first()) : 0; 989 if (actionButton) 990 new QIConstrainKeeper (actionButton); 991 break; 992 } 982 993 983 994 default: -
trunk/src/VBox/Frontends/VirtualBox/ui/VBoxVMSettingsDlg.ui
r1925 r2170 2841 2841 <slot>cdMediaChanged()</slot> 2842 2842 <slot>fdMediaChanged()</slot> 2843 <slot>processAdjustSize()</slot>2844 2843 <slot>updateInterfaces( QWidget* )</slot> 2845 2844 <slot>networkPageUpdate( QWidget* )</slot> -
trunk/src/VBox/Frontends/VirtualBox/ui/VBoxVMSettingsDlg.ui.h
r2154 r2170 424 424 6 /* seems that RichText adds some margin */ + 425 425 whatsThisLabel->fontMetrics().width ('m') * 40); 426 connect (whatsThisLabel, SIGNAL (textChanged()), this, SLOT (processAdjustSize()));427 426 428 427 /* … … 799 798 VBoxGlobal::centerWidget (this, parentWidget()); 800 799 } 801 802 void VBoxVMSettingsDlg::processAdjustSize()803 {804 int newHeight = minimumSize().height();805 int oldHeight = height();806 if (newHeight > oldHeight)807 resize (minimumSize());808 }809 810 800 811 801 void VBoxVMSettingsDlg::updateShortcuts()
Note:
See TracChangeset
for help on using the changeset viewer.