Changeset 47016 in vbox for trunk/src/VBox/Frontends
- Timestamp:
- Jul 5, 2013 4:58:04 PM (12 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src/widgets
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/widgets/UIPopupPane.cpp
r47014 r47016 33 33 bool fProposeAutoConfirmation) 34 34 : QWidget(pParent) 35 , m_fPolished(false) 35 36 , m_iLayoutMargin(10), m_iLayoutSpacing(5) 36 37 , m_strMessage(strMessage), m_strDetails(strDetails) 37 38 , m_fProposeAutoConfirmation(fProposeAutoConfirmation) 38 39 , m_buttonDescriptions(buttonDescriptions) 40 , m_fShown(false) 41 , m_pShowAnimation(0) 39 42 , m_fHovered(false) 40 43 , m_iDefaultOpacity(180) … … 91 94 } 92 95 96 void UIPopupPane::setMinimumSizeHint(const QSize &minimumSizeHint) 97 { 98 /* Make sure the size-hint is changed: */ 99 if (m_minimumSizeHint == minimumSizeHint) 100 return; 101 102 /* Assign new size-hint: */ 103 m_minimumSizeHint = minimumSizeHint; 104 105 /* Notify parent popup-stack: */ 106 emit sigSizeHintChanged(); 107 } 108 93 109 void UIPopupPane::updateSizeHint() 94 110 { … … 119 135 } 120 136 121 /* Compose minimum size-hint: */ 122 m_minimumSizeHint = QSize(iMinimumWidthHint, iMinimumHeightHint); 137 /* Compose minimum size-hints: */ 138 m_hiddenSizeHint = QSize(iMinimumWidthHint, 1); 139 m_shownSizeHint = QSize(iMinimumWidthHint, iMinimumHeightHint); 140 m_minimumSizeHint = m_fShown ? m_shownSizeHint : m_hiddenSizeHint; 141 142 /* Update 'show/hide' animation: */ 143 if (m_pShowAnimation) 144 m_pShowAnimation->update(); 123 145 } 124 146 … … 152 174 } 153 175 176 void UIPopupPane::sltMarkAsShown() 177 { 178 /* Mark popup-pane as 'shown': */ 179 m_fShown = true; 180 } 181 154 182 void UIPopupPane::sltAdjustGeometry() 155 183 { … … 212 240 void UIPopupPane::prepareAnimation() 213 241 { 242 /* Install 'show' animation for 'minimumSizeHint' property: */ 243 connect(this, SIGNAL(sigToShow()), this, SIGNAL(sigShow()), Qt::QueuedConnection); 244 m_pShowAnimation = UIAnimation::installPropertyAnimation(this, "minimumSizeHint", "hiddenSizeHint", "shownSizeHint", 245 SIGNAL(sigShow()), SIGNAL(sigHide())); 246 connect(m_pShowAnimation, SIGNAL(sigStateEnteredFinal()), this, SLOT(sltMarkAsShown())); 247 214 248 /* Install 'hover' animation for 'opacity' property: */ 215 249 UIAnimation::installPropertyAnimation(this, "opacity", "defaultOpacity", "hoveredOpacity", … … 274 308 /* Do not filter anything: */ 275 309 return false; 310 } 311 312 void UIPopupPane::showEvent(QShowEvent *pEvent) 313 { 314 /* Call to base-class: */ 315 QWidget::showEvent(pEvent); 316 317 /* Polish border: */ 318 if (m_fPolished) 319 return; 320 m_fPolished = true; 321 322 /* Call to polish event: */ 323 polishEvent(pEvent); 324 } 325 326 void UIPopupPane::polishEvent(QShowEvent*) 327 { 328 /* Emit signal to start *show* animation: */ 329 emit sigToShow(); 276 330 } 277 331 -
trunk/src/VBox/Frontends/VirtualBox/src/widgets/UIPopupPane.h
r47014 r47016 27 27 class UIPopupPaneTextPane; 28 28 class UIPopupPaneButtonPane; 29 class UIAnimation; 29 30 30 31 /* Popup-pane prototype: */ … … 32 33 { 33 34 Q_OBJECT; 35 Q_PROPERTY(QSize hiddenSizeHint READ hiddenSizeHint); 36 Q_PROPERTY(QSize shownSizeHint READ shownSizeHint); 37 Q_PROPERTY(QSize minimumSizeHint READ minimumSizeHint WRITE setMinimumSizeHint); 34 38 Q_PROPERTY(int defaultOpacity READ defaultOpacity); 35 39 Q_PROPERTY(int hoveredOpacity READ hoveredOpacity); … … 37 41 38 42 signals: 43 44 /* Notifiers: Show/hide stuff: */ 45 void sigToShow(); 46 void sigToHide(); 47 void sigShow(); 48 void sigHide(); 39 49 40 50 /* Notifiers: Hover stuff: */ … … 69 79 /* API: Layout stuff: */ 70 80 QSize minimumSizeHint() const { return m_minimumSizeHint; } 81 void setMinimumSizeHint(const QSize &minimumSizeHint); 71 82 void updateSizeHint(); 72 83 void setDesiredWidth(int iWidth); … … 74 85 75 86 private slots: 87 88 /* Handler: Show/hide stuff: */ 89 void sltMarkAsShown(); 76 90 77 91 /* Handler: Layout stuff: */ … … 91 105 bool eventFilter(QObject *pWatched, QEvent *pEvent); 92 106 93 /* Handler: Event stuff: */ 107 /* Handlers: Event stuff: */ 108 void showEvent(QShowEvent *pEvent); 109 void polishEvent(QShowEvent *pEvent); 94 110 void paintEvent(QPaintEvent *pEvent); 95 111 … … 101 117 void done(int iResultCode); 102 118 119 /* Property: Show/hide stuff: */ 120 QSize hiddenSizeHint() const { return m_hiddenSizeHint; } 121 QSize shownSizeHint() const { return m_shownSizeHint; } 122 103 123 /* Property: Hover stuff: */ 104 124 int defaultOpacity() const { return m_iDefaultOpacity; } … … 108 128 109 129 /* Variables: General stuff: */ 130 bool m_fPolished; 110 131 const QString m_strId; 111 132 const int m_iLayoutMargin; … … 121 142 /* Variables: Button stuff: */ 122 143 QMap<int, QString> m_buttonDescriptions; 144 145 /* Variables: Show/hide stuff: */ 146 bool m_fShown; 147 UIAnimation *m_pShowAnimation; 148 QSize m_hiddenSizeHint; 149 QSize m_shownSizeHint; 123 150 124 151 /* Variables: Hover stuff: */
Note:
See TracChangeset
for help on using the changeset viewer.