src/gui/dialogs/qdialog.cpp
changeset 30 5dc02b23752f
parent 22 79de32ba3296
child 33 3e2da88830cd
equal deleted inserted replaced
29:b72c6db6890b 30:5dc02b23752f
   256   \sa QWidget::setWindowFlags()
   256   \sa QWidget::setWindowFlags()
   257 */
   257 */
   258 
   258 
   259 QDialog::QDialog(QWidget *parent, Qt::WindowFlags f)
   259 QDialog::QDialog(QWidget *parent, Qt::WindowFlags f)
   260     : QWidget(*new QDialogPrivate, parent,
   260     : QWidget(*new QDialogPrivate, parent,
   261               f | QFlag((f & Qt::WindowType_Mask) == 0 ? Qt::Dialog : 0))
   261               f | ((f & Qt::WindowType_Mask) == 0 ? Qt::Dialog : Qt::WindowType(0)))
   262 {
   262 {
   263 #ifdef Q_WS_WINCE
   263 #ifdef Q_WS_WINCE
   264     if (!qt_wince_is_smartphone())
   264     if (!qt_wince_is_smartphone())
   265         setWindowFlags(windowFlags() | Qt::WindowOkButtonHint | QFlag(qt_wince_is_mobile() ? 0 : Qt::WindowCancelButtonHint));
   265         setWindowFlags(windowFlags() | Qt::WindowOkButtonHint | QFlag(qt_wince_is_mobile() ? 0 : Qt::WindowCancelButtonHint));
   266 #endif
   266 #endif
   293 /*!
   293 /*!
   294   \overload
   294   \overload
   295   \internal
   295   \internal
   296 */
   296 */
   297 QDialog::QDialog(QDialogPrivate &dd, QWidget *parent, Qt::WindowFlags f)
   297 QDialog::QDialog(QDialogPrivate &dd, QWidget *parent, Qt::WindowFlags f)
   298     : QWidget(dd, parent, f | QFlag((f & Qt::WindowType_Mask) == 0 ? Qt::Dialog : 0))
   298     : QWidget(dd, parent, f | ((f & Qt::WindowType_Mask) == 0 ? Qt::Dialog : Qt::WindowType(0)))
   299 {
   299 {
   300 #ifdef Q_WS_WINCE
   300 #ifdef Q_WS_WINCE
   301     if (!qt_wince_is_smartphone())
   301     if (!qt_wince_is_smartphone())
   302         setWindowFlags(windowFlags() | Qt::WindowOkButtonHint | QFlag(qt_wince_is_mobile() ? 0 : Qt::WindowCancelButtonHint));
   302         setWindowFlags(windowFlags() | Qt::WindowOkButtonHint | QFlag(qt_wince_is_mobile() ? 0 : Qt::WindowCancelButtonHint));
   303 #endif
   303 #endif
   639             return;
   639             return;
   640     }
   640     }
   641     while (w && w->whatsThis().size() == 0 && !w->testAttribute(Qt::WA_CustomWhatsThis))
   641     while (w && w->whatsThis().size() == 0 && !w->testAttribute(Qt::WA_CustomWhatsThis))
   642         w = w->isWindow() ? 0 : w->parentWidget();
   642         w = w->isWindow() ? 0 : w->parentWidget();
   643     if (w) {
   643     if (w) {
   644         QMenu p(this);
   644         QWeakPointer<QMenu> p = new QMenu(this);
   645         QAction *wt = p.addAction(tr("What's This?"));
   645         QAction *wt = p.data()->addAction(tr("What's This?"));
   646         if (p.exec(e->globalPos()) == wt) {
   646         if (p.data()->exec(e->globalPos()) == wt) {
   647             QHelpEvent e(QEvent::WhatsThis, w->rect().center(),
   647             QHelpEvent e(QEvent::WhatsThis, w->rect().center(),
   648                          w->mapToGlobal(w->rect().center()));
   648                          w->mapToGlobal(w->rect().center()));
   649             QApplication::sendEvent(w, &e);
   649             QApplication::sendEvent(w, &e);
   650         }
   650         }
       
   651         delete p.data();
   651     }
   652     }
   652 #endif
   653 #endif
   653 }
   654 }
   654 #endif // QT_NO_CONTEXTMENU
   655 #endif // QT_NO_CONTEXTMENU
   655 
   656