Changeset 2592 in vbox
- Timestamp:
- May 11, 2007 12:31:38 PM (18 years ago)
- svn:sync-xref-src-repo-rev:
- 21090
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/include/VBoxUtils.h
r2578 r2592 29 29 #include <qtextedit.h> 30 30 #include <qlabel.h> 31 #include <qlayout.h> 31 32 32 33 /** … … 206 207 207 208 QILabel (QWidget *aParent, const char *aName) 208 : QLabel (aParent, aName), mS izeHint (-1, -1)209 : QLabel (aParent, aName), mShowed (false) 209 210 { 210 211 /* setup default size policy and alignment */ … … 215 216 setAlignment (int (QLabel::WordBreak | QLabel::AlignTop)); 216 217 /* install show-parent-widget watcher */ 217 aParent-> installEventFilter (this);218 aParent->topLevelWidget()->installEventFilter (this); 218 219 } 219 220 220 221 QSize sizeHint() const 221 222 { 222 /* use cashed sizeHint if mSizeHint is valid */ 223 if (!mSizeHint.isValid()) 224 mSizeHint = QLabel::sizeHint(); 225 return mSizeHint; 223 return mShowed ? 224 QSize (width(), heightForWidth (width())) : QLabel::sizeHint(); 226 225 } 227 226 … … 234 233 case QEvent::Show: 235 234 { 236 /* watch for parent's show-event to recalculate sizeHint */237 mSizeHint = QSize (width(), heightForWidth (width()));238 updateGeometry();235 mShowed = true; 236 if (parent() && ((QWidget*)parent())->layout()) 237 ((QWidget*)parent())->layout()->activate(); 239 238 break; 240 239 } … … 245 244 } 246 245 247 mutable QSize mSizeHint;246 bool mShowed; 248 247 }; 249 248
Note:
See TracChangeset
for help on using the changeset viewer.