From b1a7a7b250e3575579ad43979c5bc27283f3d5f2 Mon Sep 17 00:00:00 2001 From: Stephan Binner Date: Fri, 10 Mar 2017 13:20:12 +0100 Subject: Add feature.dialog Change-Id: I160d0f270d7f41671459358b9c180d71dd7786d6 Reviewed-by: Oswald Buddenhagen --- src/widgets/configure.json | 16 +++++++++++++++- src/widgets/dialogs/dialogs.pri | 12 +++++++++--- src/widgets/dialogs/qcolordialog.h | 9 +++++---- src/widgets/dialogs/qdialog.h | 2 ++ src/widgets/dialogs/qdialog_p.h | 2 ++ src/widgets/dialogs/qerrormessage.h | 9 +++++---- src/widgets/dialogs/qfiledialog.h | 9 +++++---- src/widgets/dialogs/qfontdialog.h | 11 ++++++----- src/widgets/dialogs/qinputdialog.h | 11 ++++++----- src/widgets/dialogs/qmessagebox.h | 9 +++++---- src/widgets/dialogs/qprogressdialog.h | 9 +++++---- src/widgets/dialogs/qwizard.h | 5 +++-- src/widgets/itemviews/qitemdelegate.cpp | 1 - src/widgets/itemviews/qstyleditemdelegate.cpp | 1 - src/widgets/styles/qstylesheetstyle.cpp | 7 ++++++- src/widgets/widgets/qpushbutton.cpp | 13 ++++++++++++- src/widgets/widgets/qpushbutton_p.h | 4 ++++ 17 files changed, 90 insertions(+), 40 deletions(-) (limited to 'src/widgets') diff --git a/src/widgets/configure.json b/src/widgets/configure.json index dedea8c59e..13c7c774ed 100644 --- a/src/widgets/configure.json +++ b/src/widgets/configure.json @@ -468,11 +468,17 @@ "condition": "features.lineedit && features.shortcut", "output": [ "publicFeature", "feature" ] }, + "dialog" : { + "label": "QDialog", + "purpose": "Base class of dialog windows.", + "section": "Dialogs", + "output": [ "publicFeature" ] + }, "dialogbuttonbox": { "label": "QDialogButtonBox", "purpose": "Presents buttons in a layout that is appropriate for the current widget style.", "section": "Dialogs", - "condition": "features.pushbutton", + "condition": "features.dialog && features.pushbutton", "output": [ "publicFeature" ] }, "messagebox": { @@ -481,6 +487,7 @@ "section": "Dialogs", "condition" : [ "features.checkbox", + "features.dialog", "features.dialogbuttonbox", "features.label", "features.pushbutton" @@ -492,6 +499,7 @@ "purpose": "Provides a dialog widget for specifying colors.", "section": "Dialogs", "condition": [ + "features.dialog", "features.dialogbuttonbox", "features.label", "features.pushbutton", @@ -506,6 +514,7 @@ "condition": [ "features.buttongroup", "features.combobox", + "features.dialog", "features.dialogbuttonbox", "features.dirmodel", "features.label", @@ -524,6 +533,7 @@ "condition": [ "features.checkbox", "features.combobox", + "features.dialog", "features.dialogbuttonbox", "features.groupbox", "features.label", @@ -538,6 +548,7 @@ "purpose": "Provides feedback on the progress of a slow operation.", "section": "Dialogs", "condition": [ + "features.dialog", "features.label", "features.pushbutton", "features.progressbar" @@ -550,6 +561,7 @@ "section": "Dialogs", "condition": [ "features.combobox", + "features.dialog", "features.dialogbuttonbox", "features.label", "features.pushbutton", @@ -565,6 +577,7 @@ "section": "Dialogs", "condition": [ "features.checkbox", + "features.dialog", "features.textedit", "features.label", "features.pushbutton", @@ -577,6 +590,7 @@ "purpose": "Provides a framework for multi-page click-through dialogs.", "section": "Dialogs", "condition": [ + "features.dialog", "features.pushbutton", "features.properties", "features.label" diff --git a/src/widgets/dialogs/dialogs.pri b/src/widgets/dialogs/dialogs.pri index 4f4a9b1517..8614d2bcc6 100644 --- a/src/widgets/dialogs/dialogs.pri +++ b/src/widgets/dialogs/dialogs.pri @@ -3,8 +3,6 @@ HEADERS += \ dialogs/qcolordialog.h \ dialogs/qfscompleter_p.h \ - dialogs/qdialog.h \ - dialogs/qdialog_p.h \ dialogs/qerrormessage.h \ dialogs/qfiledialog.h \ dialogs/qfiledialog_p.h \ @@ -30,7 +28,6 @@ else: FORMS += dialogs/qfiledialog.ui INCLUDEPATH += $$PWD SOURCES += \ dialogs/qcolordialog.cpp \ - dialogs/qdialog.cpp \ dialogs/qerrormessage.cpp \ dialogs/qfiledialog.cpp \ dialogs/qfontdialog.cpp \ @@ -42,4 +39,13 @@ SOURCES += \ dialogs/qfileinfogatherer.cpp \ dialogs/qwizard.cpp \ +qtConfig(dialog) { + HEADERS += \ + dialogs/qdialog.h \ + dialogs/qdialog_p.h + + SOURCES += \ + dialogs/qdialog.cpp +} + RESOURCES += dialogs/qmessagebox.qrc diff --git a/src/widgets/dialogs/qcolordialog.h b/src/widgets/dialogs/qcolordialog.h index 3b56f0b5d1..fb5b843ce4 100644 --- a/src/widgets/dialogs/qcolordialog.h +++ b/src/widgets/dialogs/qcolordialog.h @@ -41,13 +41,14 @@ #define QCOLORDIALOG_H #include + +#ifndef QT_NO_COLORDIALOG + #include QT_BEGIN_NAMESPACE -#ifndef QT_NO_COLORDIALOG - class QColorDialogPrivate; class Q_WIDGETS_EXPORT QColorDialog : public QDialog @@ -124,8 +125,8 @@ private: Q_DECLARE_OPERATORS_FOR_FLAGS(QColorDialog::ColorDialogOptions) -#endif // QT_NO_COLORDIALOG - QT_END_NAMESPACE +#endif // QT_NO_COLORDIALOG + #endif // QCOLORDIALOG_H diff --git a/src/widgets/dialogs/qdialog.h b/src/widgets/dialogs/qdialog.h index d88ff4a841..72250172d3 100644 --- a/src/widgets/dialogs/qdialog.h +++ b/src/widgets/dialogs/qdialog.h @@ -43,6 +43,8 @@ #include #include +QT_REQUIRE_CONFIG(dialog); + QT_BEGIN_NAMESPACE diff --git a/src/widgets/dialogs/qdialog_p.h b/src/widgets/dialogs/qdialog_p.h index 6723edae38..9ee89863f6 100644 --- a/src/widgets/dialogs/qdialog_p.h +++ b/src/widgets/dialogs/qdialog_p.h @@ -61,6 +61,8 @@ #endif #include +QT_REQUIRE_CONFIG(dialog); + QT_BEGIN_NAMESPACE class QSizeGrip; diff --git a/src/widgets/dialogs/qerrormessage.h b/src/widgets/dialogs/qerrormessage.h index 5ffa568c10..976ba9abd5 100644 --- a/src/widgets/dialogs/qerrormessage.h +++ b/src/widgets/dialogs/qerrormessage.h @@ -41,13 +41,14 @@ #define QERRORMESSAGE_H #include + +#ifndef QT_NO_ERRORMESSAGE + #include QT_BEGIN_NAMESPACE -#ifndef QT_NO_ERRORMESSAGE - class QErrorMessagePrivate; class Q_WIDGETS_EXPORT QErrorMessage: public QDialog @@ -72,8 +73,8 @@ private: Q_DISABLE_COPY(QErrorMessage) }; -#endif // QT_NO_ERRORMESSAGE - QT_END_NAMESPACE +#endif // QT_NO_ERRORMESSAGE + #endif // QERRORMESSAGE_H diff --git a/src/widgets/dialogs/qfiledialog.h b/src/widgets/dialogs/qfiledialog.h index 7959eebd7b..733dd03092 100644 --- a/src/widgets/dialogs/qfiledialog.h +++ b/src/widgets/dialogs/qfiledialog.h @@ -44,13 +44,14 @@ #include #include #include + +#ifndef QT_NO_FILEDIALOG + #include QT_BEGIN_NAMESPACE -#ifndef QT_NO_FILEDIALOG - class QModelIndex; class QItemSelection; struct QFileDialogArgs; @@ -313,8 +314,8 @@ inline void QFileDialog::setDirectory(const QDir &adirectory) Q_DECLARE_OPERATORS_FOR_FLAGS(QFileDialog::Options) -#endif // QT_NO_FILEDIALOG - QT_END_NAMESPACE +#endif // QT_NO_FILEDIALOG + #endif // QFILEDIALOG_H diff --git a/src/widgets/dialogs/qfontdialog.h b/src/widgets/dialogs/qfontdialog.h index 276f8f5e83..da13a5ab99 100644 --- a/src/widgets/dialogs/qfontdialog.h +++ b/src/widgets/dialogs/qfontdialog.h @@ -42,13 +42,14 @@ #include #include -#include #include -QT_BEGIN_NAMESPACE +#ifndef QT_NO_FONTDIALOG +#include + +QT_BEGIN_NAMESPACE -#ifndef QT_NO_FONTDIALOG class QFontDialogPrivate; @@ -117,8 +118,8 @@ private: Q_DECLARE_OPERATORS_FOR_FLAGS(QFontDialog::FontDialogOptions) -#endif // QT_NO_FONTDIALOG - QT_END_NAMESPACE +#endif // QT_NO_FONTDIALOG + #endif // QFONTDIALOG_H diff --git a/src/widgets/dialogs/qinputdialog.h b/src/widgets/dialogs/qinputdialog.h index 2fbea908cb..7b43e774a7 100644 --- a/src/widgets/dialogs/qinputdialog.h +++ b/src/widgets/dialogs/qinputdialog.h @@ -41,14 +41,15 @@ #define QINPUTDIALOG_H #include -#include #include #include -QT_BEGIN_NAMESPACE +#ifndef QT_NO_INPUTDIALOG +#include + +QT_BEGIN_NAMESPACE -#ifndef QT_NO_INPUTDIALOG class QInputDialogPrivate; @@ -209,8 +210,8 @@ private: Q_DECLARE_OPERATORS_FOR_FLAGS(QInputDialog::InputDialogOptions) -#endif // QT_NO_INPUTDIALOG - QT_END_NAMESPACE +#endif // QT_NO_INPUTDIALOG + #endif // QINPUTDIALOG_H diff --git a/src/widgets/dialogs/qmessagebox.h b/src/widgets/dialogs/qmessagebox.h index 3e561a5161..40e5c701fe 100644 --- a/src/widgets/dialogs/qmessagebox.h +++ b/src/widgets/dialogs/qmessagebox.h @@ -41,13 +41,14 @@ #define QMESSAGEBOX_H #include + +#ifndef QT_NO_MESSAGEBOX + #include QT_BEGIN_NAMESPACE -#ifndef QT_NO_MESSAGEBOX - class QLabel; class QMessageBoxPrivate; class QAbstractButton; @@ -322,8 +323,8 @@ QString s = QApplication::tr("Executable '%1' requires Qt "\ str)).arg(QString::fromLatin1(qVersion())); QMessageBox::critical(0, QApplication::tr(\ "Incompatible Qt Library Error"), s, QMessageBox::Abort, 0); qFatal("%s", s.toLatin1().data()); }} -#endif // QT_NO_MESSAGEBOX - QT_END_NAMESPACE +#endif // QT_NO_MESSAGEBOX + #endif // QMESSAGEBOX_H diff --git a/src/widgets/dialogs/qprogressdialog.h b/src/widgets/dialogs/qprogressdialog.h index a5e333259f..f4e63fb088 100644 --- a/src/widgets/dialogs/qprogressdialog.h +++ b/src/widgets/dialogs/qprogressdialog.h @@ -41,13 +41,14 @@ #define QPROGRESSDIALOG_H #include + +#ifndef QT_NO_PROGRESSDIALOG + #include QT_BEGIN_NAMESPACE -#ifndef QT_NO_PROGRESSDIALOG - class QPushButton; class QLabel; class QProgressBar; @@ -127,8 +128,8 @@ private: Q_PRIVATE_SLOT(d_func(), void _q_disconnectOnClose()) }; -#endif // QT_NO_PROGRESSDIALOG - QT_END_NAMESPACE +#endif // QT_NO_PROGRESSDIALOG + #endif // QPROGRESSDIALOG_H diff --git a/src/widgets/dialogs/qwizard.h b/src/widgets/dialogs/qwizard.h index 7915c9e7f8..3236ee90df 100644 --- a/src/widgets/dialogs/qwizard.h +++ b/src/widgets/dialogs/qwizard.h @@ -41,13 +41,14 @@ #define QWIZARD_H #include + +#ifndef QT_NO_WIZARD + #include QT_BEGIN_NAMESPACE -#ifndef QT_NO_WIZARD - class QAbstractButton; class QWizardPage; class QWizardPrivate; diff --git a/src/widgets/itemviews/qitemdelegate.cpp b/src/widgets/itemviews/qitemdelegate.cpp index 747d5db782..6a6220cd0a 100644 --- a/src/widgets/itemviews/qitemdelegate.cpp +++ b/src/widgets/itemviews/qitemdelegate.cpp @@ -62,7 +62,6 @@ #include #include #include -#include #include #include diff --git a/src/widgets/itemviews/qstyleditemdelegate.cpp b/src/widgets/itemviews/qstyleditemdelegate.cpp index e4115c9e60..4149d3ac3a 100644 --- a/src/widgets/itemviews/qstyleditemdelegate.cpp +++ b/src/widgets/itemviews/qstyleditemdelegate.cpp @@ -67,7 +67,6 @@ #include #include #include -#include #include #include diff --git a/src/widgets/styles/qstylesheetstyle.cpp b/src/widgets/styles/qstylesheetstyle.cpp index 2886093732..94ded82ef5 100644 --- a/src/widgets/styles/qstylesheetstyle.cpp +++ b/src/widgets/styles/qstylesheetstyle.cpp @@ -77,7 +77,9 @@ #include #include #include +#if QT_CONFIG(dialog) #include +#endif #include #include #if QT_CONFIG(label) @@ -2819,7 +2821,10 @@ void QStyleSheetStyle::polish(QWidget *w) #ifndef QT_NO_MENUBAR || qobject_cast(w) #endif - || qobject_cast(w)) { +#if QT_CONFIG(dialog) + || qobject_cast(w) +#endif + ) { w->setAttribute(Qt::WA_StyledBackground, true); } QWidget *ew = embeddedWidget(w); diff --git a/src/widgets/widgets/qpushbutton.cpp b/src/widgets/widgets/qpushbutton.cpp index 20758679f0..5b1e10eb32 100644 --- a/src/widgets/widgets/qpushbutton.cpp +++ b/src/widgets/widgets/qpushbutton.cpp @@ -40,8 +40,9 @@ #include "qapplication.h" #include "qbitmap.h" #include "qdesktopwidget.h" -#include "qdialog.h" +#if QT_CONFIG(dialog) #include +#endif #include "qdrawutil.h" #include "qevent.h" #include "qfontmetrics.h" @@ -292,6 +293,7 @@ QPushButton::~QPushButton() { } +#if QT_CONFIG(dialog) QDialog *QPushButtonPrivate::dialogParent() const { Q_Q(const QPushButton); @@ -303,6 +305,7 @@ QDialog *QPushButtonPrivate::dialogParent() const } return 0; } +#endif /*! Initialize \a option with the values from this QPushButton. This method is useful @@ -366,10 +369,12 @@ void QPushButton::setDefault(bool enable) if (d->defaultButton == enable) return; d->defaultButton = enable; +#if QT_CONFIG(dialog) if (d->defaultButton) { if (QDialog *dlg = d->dialogParent()) dlg->d_func()->setMainDefault(this); } +#endif update(); #ifndef QT_NO_ACCESSIBILITY QAccessible::State s; @@ -478,9 +483,11 @@ void QPushButton::focusInEvent(QFocusEvent *e) Q_D(QPushButton); if (e->reason() != Qt::PopupFocusReason && autoDefault() && !d->defaultButton) { d->defaultButton = true; +#if QT_CONFIG(dialog) QDialog *dlg = qobject_cast(window()); if (dlg) dlg->d_func()->setDefault(this); +#endif } QAbstractButton::focusInEvent(e); } @@ -492,11 +499,13 @@ void QPushButton::focusOutEvent(QFocusEvent *e) { Q_D(QPushButton); if (e->reason() != Qt::PopupFocusReason && autoDefault() && d->defaultButton) { +#if QT_CONFIG(dialog) QDialog *dlg = qobject_cast(window()); if (dlg) dlg->d_func()->setDefault(0); else d->defaultButton = false; +#endif } QAbstractButton::focusOutEvent(e); @@ -661,10 +670,12 @@ bool QPushButton::event(QEvent *e) { Q_D(QPushButton); if (e->type() == QEvent::ParentChange) { +#if QT_CONFIG(dialog) if (QDialog *dialog = d->dialogParent()) { if (d->defaultButton) dialog->d_func()->setMainDefault(this); } +#endif } else if (e->type() == QEvent::StyleChange #ifdef Q_OS_MAC || e->type() == QEvent::MacSizeChange diff --git a/src/widgets/widgets/qpushbutton_p.h b/src/widgets/widgets/qpushbutton_p.h index 198091503a..a32b599b94 100644 --- a/src/widgets/widgets/qpushbutton_p.h +++ b/src/widgets/widgets/qpushbutton_p.h @@ -81,7 +81,11 @@ public: #endif void resetLayoutItemMargins(); void _q_popupPressed(); +#if QT_CONFIG(dialog) QDialog *dialogParent() const; +#else + QDialog *dialogParent() const { return 0; }; +#endif QPointer menu; uint autoDefault : 2; -- cgit v1.2.3