Changeset 99194 in vbox for trunk/src/VBox/Frontends
- Timestamp:
- Mar 28, 2023 11:43:51 AM (22 months ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src/wizards
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/wizards/UINativeWizard.cpp
r98103 r99194 93 93 WizardMode enmMode /* = WizardMode_Auto */, 94 94 const QString &strHelpTag /* = QString() */) 95 : QIWithRetranslateUI <QDialog>(pParent)95 : QIWithRetranslateUI2<QDialog>(pParent, Qt::Window) 96 96 , m_enmType(enmType) 97 97 , m_enmMode(enmMode == WizardMode_Auto ? gEDataManager->modeForWizardType(m_enmType) : enmMode) 98 98 , m_strHelpHashtag(strHelpTag) 99 99 , m_iLastIndex(-1) 100 , m_fClosed(false) 100 101 , m_pLabelPixmap(0) 101 102 , m_pLayoutRight(0) … … 136 137 137 138 /* Call to base-class: */ 138 return QIWithRetranslateUI<QDialog>::exec(); 139 return QIWithRetranslateUI2<QDialog>::exec(); 140 } 141 142 void UINativeWizard::show() 143 { 144 /* Init wizard: */ 145 init(); 146 147 /* Call to base-class: */ 148 return QIWithRetranslateUI2<QDialog>::show(); 139 149 } 140 150 … … 241 251 pButtonCancel->setText(tr("&Cancel")); 242 252 pButtonCancel->setToolTip(tr("Cancel wizard execution.")); 253 } 254 255 void UINativeWizard::keyPressEvent(QKeyEvent *pEvent) 256 { 257 /* Different handling depending on current modality: */ 258 const Qt::WindowModality enmModality = windowHandle()->modality(); 259 260 /* For non-modal case: */ 261 if (enmModality == Qt::NonModal) 262 { 263 /* Special pre-processing for some keys: */ 264 switch (pEvent->key()) 265 { 266 case Qt::Key_Escape: 267 { 268 close(); 269 return; 270 } 271 default: 272 break; 273 } 274 } 275 276 /* Call to base-class: */ 277 return QIWithRetranslateUI2<QDialog>::keyPressEvent(pEvent); 278 } 279 280 void UINativeWizard::closeEvent(QCloseEvent *pEvent) 281 { 282 /* Different handling depending on current modality: */ 283 const Qt::WindowModality enmModality = windowHandle()->modality(); 284 285 /* For non-modal case: */ 286 if (enmModality == Qt::NonModal) 287 { 288 /* Ignore event initially: */ 289 pEvent->ignore(); 290 291 /* Tell the listener to close us (once): */ 292 if (!m_fClosed) 293 { 294 m_fClosed = true; 295 emit sigClose(m_enmType); 296 } 297 298 return; 299 } 300 301 /* Call to base-class: */ 302 QIWithRetranslateUI2<QDialog>::closeEvent(pEvent); 243 303 } 244 304 … … 513 573 this, &UINativeWizard::sltNext); 514 574 connect(wizardButton(WizardButtonType_Cancel), &QPushButton::clicked, 515 this, &UINativeWizard:: reject);575 this, &UINativeWizard::close); 516 576 } 517 577 -
trunk/src/VBox/Frontends/VirtualBox/src/wizards/UINativeWizard.h
r98103 r99194 83 83 84 84 /** QDialog extension with advanced functionality emulating QWizard behavior. */ 85 class SHARED_LIBRARY_STUFF UINativeWizard : public QIWithRetranslateUI <QDialog>85 class SHARED_LIBRARY_STUFF UINativeWizard : public QIWithRetranslateUI2<QDialog> 86 86 { 87 87 Q_OBJECT; 88 89 signals: 90 91 /** Notifies listeners about dialog should be closed. */ 92 void sigClose(WizardType enmType); 88 93 89 94 public: … … 113 118 * @note You shouldn't have to override it! */ 114 119 virtual int exec() /* final */; 120 /** Shows wizard in non-mode. 121 * @note You shouldn't have to override it! */ 122 virtual void show() /* final */; 115 123 116 124 protected: … … 141 149 /** Handles translation event. */ 142 150 virtual void retranslateUi() RT_OVERRIDE; 151 152 /** Handles key-press @a pEvent. */ 153 virtual void keyPressEvent(QKeyEvent *pEvent) RT_OVERRIDE; 154 /** Handles close @a pEvent. */ 155 virtual void closeEvent(QCloseEvent *pEvent) RT_OVERRIDE; 143 156 144 157 /** Performs wizard-specific cleanup in case of wizard-mode change … … 199 212 /** Holds the set of invisible pages. */ 200 213 QSet<int> m_invisiblePages; 214 /** Holds whether the dialod had emitted signal to be closed. */ 215 bool m_fClosed; 201 216 202 217 /** Holds the pixmap label instance. */
Note:
See TracChangeset
for help on using the changeset viewer.