Changeset 68328 in vbox
- Timestamp:
- Aug 8, 2017 7:46:36 AM (7 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src
- Files:
-
- 3 edited
-
extensions/QIComboBox.cpp (modified) (1 diff)
-
extensions/QIComboBox.h (modified) (1 diff)
-
widgets/UIFilePathSelector.cpp (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/extensions/QIComboBox.cpp
r68079 r68328 166 166 AssertPtrReturn(m_pComboBox, 0); 167 167 return m_pComboBox->lineEdit(); 168 } 169 170 QComboBox *QIComboBox::comboBox() const 171 { 172 return m_pComboBox; 168 173 } 169 174 -
trunk/src/VBox/Frontends/VirtualBox/src/extensions/QIComboBox.h
r64540 r68328 113 113 void setItemText(int iIndex, const QString &strText) const; 114 114 115 protected: 116 117 /** Returns the embedded combo-box reference. */ 118 QComboBox *comboBox() const; 119 115 120 private: 116 121 -
trunk/src/VBox/Frontends/VirtualBox/src/widgets/UIFilePathSelector.cpp
r64539 r68328 126 126 { 127 127 QIComboBox::setEditable(true); 128 129 /* Install combo-box event-filter: */ 130 Assert(comboBox()); 131 comboBox()->installEventFilter(this); 132 133 /* Install line-edit connection/event-filter: */ 128 134 Assert(lineEdit()); 129 135 connect(lineEdit(), SIGNAL(textEdited(const QString &)), 130 136 this, SLOT(onTextEdited(const QString &))); 131 132 /* Installing necessary event filters: */133 137 lineEdit()->installEventFilter(this); 134 138 } … … 137 141 if (lineEdit()) 138 142 { 139 /* Installing necessary event filters: */140 lineEdit()-> installEventFilter(this);143 /* Remove line-edit event-filter/connection: */ 144 lineEdit()->removeEventFilter(this); 141 145 disconnect(lineEdit(), SIGNAL(textEdited(const QString &)), 142 146 this, SLOT(onTextEdited(const QString &))); 147 } 148 if (comboBox()) 149 { 150 /* Remove combo-box event-filter: */ 151 comboBox()->removeEventFilter(this); 143 152 } 144 153 QIComboBox::setEditable(false); … … 177 186 bool UIFilePathSelector::eventFilter(QObject *pObject, QEvent *pEvent) 178 187 { 179 if (m_fMouseAwaited && (pEvent->type() == QEvent::MouseButtonPress)) 180 QMetaObject::invokeMethod(this, "refreshText", Qt::QueuedConnection); 181 188 /* If the object is private combo-box: */ 189 if (pObject == comboBox()) 190 { 191 /* Handle focus events related to private child: */ 192 switch (pEvent->type()) 193 { 194 case QEvent::FocusIn: focusInEvent(static_cast<QFocusEvent*>(pEvent)); break; 195 case QEvent::FocusOut: focusOutEvent(static_cast<QFocusEvent*>(pEvent)); break; 196 default: break; 197 } 198 } 199 200 /* If the object is private line-edit: */ 201 if (pObject == lineEdit()) 202 { 203 if (m_fMouseAwaited && (pEvent->type() == QEvent::MouseButtonPress)) 204 QMetaObject::invokeMethod(this, "refreshText", Qt::QueuedConnection); 205 } 206 207 /* Call to base-class: */ 182 208 return QIWithRetranslateUI<QIComboBox>::eventFilter(pObject, pEvent); 183 209 }
Note:
See TracChangeset
for help on using the changeset viewer.

