Changeset 47951 in vbox
- Timestamp:
- Aug 21, 2013 8:38:18 AM (11 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src/widgets
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/widgets/UIWarningPane.cpp
r47945 r47951 22 22 #include <QLabel> 23 23 #include <QEvent> 24 #include <QTimer> 24 25 25 26 /* GUI includes: */ … … 34 35 , m_pIconLayout(0) 35 36 , m_pTextLabel(0) 37 , m_pHoverTimer(0) 38 , m_iHoveredIconLabelPosition(-1) 36 39 { 37 40 /* Prepare: */ … … 79 82 } 80 83 84 void UIWarningPane::sltHandleHoverTimer() 85 { 86 /* Notify listeners about hovering: */ 87 if (m_iHoveredIconLabelPosition >= 0 && m_iHoveredIconLabelPosition < m_validators.size()) 88 emit sigHoverEnter(m_validators[m_iHoveredIconLabelPosition]); 89 } 90 81 91 void UIWarningPane::prepare() 82 92 { … … 110 120 pMainLayout->addLayout(m_pIconLayout); 111 121 } 122 /* Create hover-timer: */ 123 m_pHoverTimer = new QTimer(this); 124 { 125 /* Configure timer: */ 126 m_pHoverTimer->setInterval(200); 127 m_pHoverTimer->setSingleShot(true); 128 connect(m_pHoverTimer, SIGNAL(timeout()), this, SLOT(sltHandleHoverTimer())); 129 } 112 130 /* Add right stretch: */ 113 131 pMainLayout->addStretch(); … … 134 152 { 135 153 m_hovered[iIconLabelPosition] = true; 136 emit sigHoverEnter(m_validators[iIconLabelPosition]); 154 m_iHoveredIconLabelPosition = iIconLabelPosition; 155 m_pHoverTimer->start(); 137 156 } 138 157 } … … 154 173 { 155 174 m_hovered[iIconLabelPosition] = false; 156 emit sigHoverLeave(m_validators[iIconLabelPosition]); 175 if (m_pHoverTimer->isActive()) 176 { 177 m_pHoverTimer->stop(); 178 m_iHoveredIconLabelPosition = -1; 179 } 180 else 181 emit sigHoverLeave(m_validators[iIconLabelPosition]); 157 182 } 158 183 } -
trunk/src/VBox/Frontends/VirtualBox/src/widgets/UIWarningPane.h
r47847 r47951 27 27 class QHBoxLayout; 28 28 class QLabel; 29 class QTimer; 29 30 30 31 /* Warning-pane prototype: */ … … 50 51 void registerValidator(UIPageValidator *pValidator); 51 52 53 private slots: 54 55 /* Handler: Hover stuff: */ 56 void sltHandleHoverTimer(); 57 52 58 private: 53 59 … … 65 71 QList<QLabel*> m_icons; 66 72 QList<bool> m_hovered; 73 QTimer *m_pHoverTimer; 74 int m_iHoveredIconLabelPosition; 67 75 }; 68 76
Note:
See TracChangeset
for help on using the changeset viewer.