Changeset 78005 in vbox for trunk/src/VBox/Frontends/VirtualBox
- Timestamp:
- Apr 3, 2019 4:43:47 PM (6 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src/medium/viso
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/medium/viso/UIVisoBrowserBase.cpp
r77519 r78005 100 100 bool UILocationSelector::eventFilter(QObject *pObj, QEvent *pEvent) 101 101 { 102 if (pObj == m_pLineEdit) 103 { 104 if(pEvent->type() == QEvent::MouseButtonPress) 105 { 106 QMouseEvent *pMouseEvent = dynamic_cast<QMouseEvent*>(pEvent); 107 if (pMouseEvent && pMouseEvent->button() == Qt::LeftButton) 108 emit sigExpandCollapseTreeView(); 109 } 110 } 111 /* Pass the events to event system for further processing: */ 112 return false; 102 /* Handle only events sent to m_pLineEdit only: */ 103 if (pObj != m_pLineEdit) 104 return QIWithRetranslateUI<QWidget>::eventFilter(pObj, pEvent); 105 106 if (pEvent->type() == QEvent::MouseButtonPress) 107 { 108 QMouseEvent *pMouseEvent = dynamic_cast<QMouseEvent*>(pEvent); 109 if (pMouseEvent && pMouseEvent->button() == Qt::LeftButton) 110 emit sigExpandCollapseTreeView(); 111 } 112 113 /* Call to base-class: */ 114 return QIWithRetranslateUI<QWidget>::eventFilter(pObj, pEvent); 113 115 } 114 116 … … 230 232 bool UIVisoBrowserBase::eventFilter(QObject *pObj, QEvent *pEvent) 231 233 { 232 if (pObj == m_pTreeView) 233 { 234 if(pEvent->type() == QEvent::KeyPress) 235 { 236 QKeyEvent *pKeyEvent = dynamic_cast<QKeyEvent*>(pEvent); 237 if (pKeyEvent && 238 (pKeyEvent->key() == Qt::Key_Return || 239 pKeyEvent->key() == Qt::Key_Enter)) 240 { 241 updateTreeViewGeometry(false); 242 } 243 } 244 else if (pEvent->type() == QEvent::FocusOut) 234 /* Handle only events sent to m_pTreeView only: */ 235 if (pObj != m_pTreeView) 236 return QIWithRetranslateUI<QWidget>::eventFilter(pObj, pEvent); 237 238 if (pEvent->type() == QEvent::KeyPress) 239 { 240 QKeyEvent *pKeyEvent = dynamic_cast<QKeyEvent*>(pEvent); 241 if (pKeyEvent && 242 (pKeyEvent->key() == Qt::Key_Return || 243 pKeyEvent->key() == Qt::Key_Enter)) 245 244 { 246 245 updateTreeViewGeometry(false); 247 246 } 248 247 } 249 return false; 248 else if (pEvent->type() == QEvent::FocusOut) 249 { 250 updateTreeViewGeometry(false); 251 } 252 253 /* Call to base-class: */ 254 return QIWithRetranslateUI<QWidget>::eventFilter(pObj, pEvent); 250 255 } 251 256 -
trunk/src/VBox/Frontends/VirtualBox/src/medium/viso/UIVisoConfigurationPanel.cpp
r77519 r78005 26 26 #include "QIToolButton.h" 27 27 #include "UIVisoConfigurationPanel.h" 28 #include "UIVisoCreator.h" 28 29 29 UIVisoConfigurationPanel::UIVisoConfigurationPanel( QWidget *pParent /* =0 */)30 UIVisoConfigurationPanel::UIVisoConfigurationPanel(UIVisoCreator *pCreator, QWidget *pParent /* =0 */) 30 31 : UIDialogPanel(pParent) 32 , m_pCreator(pCreator) 31 33 , m_pVisoNameLabel(0) 32 34 , m_pCustomOptionsLabel(0) … … 69 71 if (!mainLayout()) 70 72 return; 73 74 /* Install creator's event-filter: */ 75 m_pCreator->installEventFilter(this); 71 76 72 77 /* Name edit and and label: */ … … 111 116 bool UIVisoConfigurationPanel::eventFilter(QObject *pObject, QEvent *pEvent) 112 117 { 118 /* Handle only events sent to creator only: */ 119 if (pObject != m_pCreator) 120 return UIDialogPanel::eventFilter(pObject, pEvent); 121 113 122 switch (pEvent->type()) 114 123 { … … 116 125 { 117 126 QKeyEvent *pKeyEvent = static_cast<QKeyEvent*>(pEvent); 118 119 if (pKeyEvent->key() == Qt::Key_Return && m_pCustomOptionsComboBox && m_pCustomOptionsComboBox->hasFocus()) 120 addCustomVisoOption(); 127 if (pKeyEvent->key() == Qt::Key_Return && m_pCustomOptionsComboBox && m_pCustomOptionsComboBox->hasFocus()) 128 addCustomVisoOption(); 121 129 return true; 122 130 break; … … 125 133 break; 126 134 } 135 136 /* Call to base-class: */ 127 137 return UIDialogPanel::eventFilter(pObject, pEvent); 128 138 } -
trunk/src/VBox/Frontends/VirtualBox/src/medium/viso/UIVisoConfigurationPanel.h
r77519 r78005 30 30 class QILineEdit; 31 31 class QIToolButton; 32 class UIVisoCreator; 32 33 33 34 class UIVisoConfigurationPanel : public UIDialogPanel … … 41 42 42 43 public: 43 UIVisoConfigurationPanel( QWidget *pParent = 0);44 UIVisoConfigurationPanel(UIVisoCreator *pCreator, QWidget *pParent = 0); 44 45 ~UIVisoConfigurationPanel(); 45 46 virtual QString panelName() const /* override */; … … 64 65 void emitCustomVisoOptions(); 65 66 67 /** Holds the parent creator reference. */ 68 UIVisoCreator *m_pCreator; 69 66 70 QILabel *m_pVisoNameLabel; 67 71 QILabel *m_pCustomOptionsLabel; -
trunk/src/VBox/Frontends/VirtualBox/src/medium/viso/UIVisoCreator.cpp
r77518 r78005 308 308 } 309 309 310 m_pConfigurationPanel = new UIVisoConfigurationPanel ;310 m_pConfigurationPanel = new UIVisoConfigurationPanel(this); 311 311 if (m_pConfigurationPanel) 312 312 { … … 315 315 m_pConfigurationPanel->setVisoName(m_visoOptions.m_strVisoName); 316 316 m_pConfigurationPanel->setVisoCustomOptions(m_visoOptions.m_customOptions); 317 installEventFilter(m_pConfigurationPanel);318 317 } 319 318
Note:
See TracChangeset
for help on using the changeset viewer.