summaryrefslogtreecommitdiffstats
path: root/src/widgets
diff options
context:
space:
mode:
Diffstat (limited to 'src/widgets')
-rw-r--r--src/widgets/accessible/qaccessiblewidgetfactory.cpp1
-rw-r--r--src/widgets/accessible/simplewidgets.cpp6
-rw-r--r--src/widgets/configure.json43
-rw-r--r--src/widgets/dialogs/qdialog.cpp9
-rw-r--r--src/widgets/dialogs/qdialog_p.h12
-rw-r--r--src/widgets/styles/qfusionstyle.cpp4
-rw-r--r--src/widgets/styles/qmacstyle_mac.mm8
-rw-r--r--src/widgets/styles/qmacstyle_mac_p.h2
-rw-r--r--src/widgets/styles/qmacstyle_mac_p_p.h4
-rw-r--r--src/widgets/styles/qwindowsvistastyle_p_p.h2
-rw-r--r--src/widgets/styles/qwindowsxpstyle.cpp2
-rw-r--r--src/widgets/util/qsystemtrayicon.cpp7
-rw-r--r--src/widgets/widgets/qpushbutton.h2
-rw-r--r--src/widgets/widgets/qpushbutton_p.h2
-rw-r--r--src/widgets/widgets/widgets.pri13
15 files changed, 104 insertions, 13 deletions
diff --git a/src/widgets/accessible/qaccessiblewidgetfactory.cpp b/src/widgets/accessible/qaccessiblewidgetfactory.cpp
index 6c31b91b45..c95b5b1097 100644
--- a/src/widgets/accessible/qaccessiblewidgetfactory.cpp
+++ b/src/widgets/accessible/qaccessiblewidgetfactory.cpp
@@ -45,7 +45,6 @@
#include "complexwidgets_p.h"
#include "itemviews_p.h"
-#include <qpushbutton.h>
#include <qtoolbutton.h>
#include <qtreeview.h>
#include <qvariant.h>
diff --git a/src/widgets/accessible/simplewidgets.cpp b/src/widgets/accessible/simplewidgets.cpp
index 97d6f90c0e..113172ff5a 100644
--- a/src/widgets/accessible/simplewidgets.cpp
+++ b/src/widgets/accessible/simplewidgets.cpp
@@ -43,7 +43,9 @@
#if QT_CONFIG(checkbox)
#include <qcheckbox.h>
#endif
+#if QT_CONFIG(pushbutton)
#include <qpushbutton.h>
+#endif
#include <qprogressbar.h>
#include <qstatusbar.h>
#if QT_CONFIG(radiobutton)
@@ -115,7 +117,7 @@ QString QAccessibleButton::text(QAccessible::Text t) const
switch (t) {
case QAccessible::Accelerator:
{
-#ifndef QT_NO_SHORTCUT
+#if QT_CONFIG(shortcut) && QT_CONFIG(pushbutton)
QPushButton *pb = qobject_cast<QPushButton*>(object());
if (pb && pb->isDefault())
str = QKeySequence(Qt::Key_Enter).toString(QKeySequence::NativeText);
@@ -155,6 +157,7 @@ QAccessible::State QAccessibleButton::state() const
#endif
if (b->isDown())
state.pressed = true;
+#if QT_CONFIG(pushbutton)
QPushButton *pb = qobject_cast<QPushButton*>(b);
if (pb) {
if (pb->isDefault())
@@ -164,6 +167,7 @@ QAccessible::State QAccessibleButton::state() const
state.hasPopup = true;
#endif
}
+#endif
return state;
}
diff --git a/src/widgets/configure.json b/src/widgets/configure.json
index b05bf465a1..33dc90b124 100644
--- a/src/widgets/configure.json
+++ b/src/widgets/configure.json
@@ -121,6 +121,7 @@
"label": "QCommandLinkButton",
"purpose": "Provides a Vista style command link button.",
"section": "Widgets",
+ "condition": "features.pushbutton",
"output": [ "publicFeature" ]
},
"datetimeedit": {
@@ -179,7 +180,7 @@
"label": "QMenu",
"purpose": "Provides popup-menus.",
"section": "Widgets",
- "condition": "features.action",
+ "condition": "features.action && features.pushbutton",
"output": [ "publicFeature", "feature" ]
},
"lineedit": {
@@ -235,6 +236,13 @@
"section": "Widgets",
"output": [ "publicFeature" ]
},
+ "pushbutton": {
+ "label": "QPushButton",
+ "purpose": "Provides a command button.",
+ "section": "Widgets",
+ "condition": "features.action",
+ "output": [ "publicFeature" ]
+ },
"toolbutton": {
"label": "QToolButton",
"purpose": "Provides quick-access buttons to commands and options.",
@@ -419,7 +427,15 @@
"label": "QCalendarWidget",
"purpose": "Provides a monthly based calendar widget allowing the user to select a date.",
"section": "Widgets",
- "condition": "features.tableview && features.menu && features.textdate && features.spinbox && features.toolbutton && features.label",
+ "condition": [
+ "features.label",
+ "features.menu",
+ "features.pushbutton",
+ "features.spinbox",
+ "features.tableview",
+ "features.textdate",
+ "features.toolbutton"
+ ],
"output": [ "publicFeature", "feature" ]
},
"keysequenceedit": {
@@ -433,6 +449,7 @@
"label": "QDialogButtonBox",
"purpose": "Presents buttons in a layout that is appropriate for the current widget style.",
"section": "Dialogs",
+ "condition": "features.pushbutton",
"output": [ "publicFeature" ]
},
"messagebox": {
@@ -442,7 +459,8 @@
"condition" : [
"features.checkbox",
"features.dialogbuttonbox",
- "features.label"
+ "features.label",
+ "features.pushbutton"
],
"output": [ "publicFeature", "feature" ]
},
@@ -453,6 +471,7 @@
"condition": [
"features.dialogbuttonbox",
"features.label",
+ "features.pushbutton",
"features.spinbox"
],
"output": [ "publicFeature", "feature" ]
@@ -485,6 +504,7 @@
"features.dialogbuttonbox",
"features.groupbox",
"features.label",
+ "features.pushbutton",
"features.stringlistmodel",
"features.validator"
],
@@ -494,7 +514,11 @@
"label": "QProgressDialog",
"purpose": "Provides feedback on the progress of a slow operation.",
"section": "Dialogs",
- "condition": "features.progressbar && features.label",
+ "condition": [
+ "features.label",
+ "features.pushbutton",
+ "features.progressbar"
+ ],
"output": [ "publicFeature", "feature" ]
},
"inputdialog": {
@@ -505,6 +529,7 @@
"features.combobox",
"features.dialogbuttonbox",
"features.label",
+ "features.pushbutton",
"features.spinbox",
"features.stackedwidget",
"features.textedit"
@@ -518,7 +543,9 @@
"condition": [
"features.checkbox",
"features.textedit",
- "features.label"
+ "features.label",
+ "features.pushbutton",
+ "features.textedit"
],
"output": [ "publicFeature", "feature" ]
},
@@ -526,7 +553,11 @@
"label": "QWizard",
"purpose": "Provides a framework for multi-page click-through dialogs.",
"section": "Dialogs",
- "condition": "features.properties && features.label",
+ "condition": [
+ "features.pushbutton",
+ "features.properties",
+ "features.label"
+ ],
"output": [ "publicFeature", "feature" ]
},
"dirmodel": {
diff --git a/src/widgets/dialogs/qdialog.cpp b/src/widgets/dialogs/qdialog.cpp
index e5715ecd57..8e74c659fa 100644
--- a/src/widgets/dialogs/qdialog.cpp
+++ b/src/widgets/dialogs/qdialog.cpp
@@ -43,7 +43,6 @@
#include "qevent.h"
#include "qdesktopwidget.h"
-#include "qpushbutton.h"
#include "qapplication.h"
#include "qlayout.h"
#include "qsizegrip.h"
@@ -367,6 +366,7 @@ QDialog::~QDialog()
default default button becomes the default button. This is what a
push button calls when it loses focus.
*/
+#if QT_CONFIG(pushbutton)
void QDialogPrivate::setDefault(QPushButton *pushButton)
{
Q_Q(QDialog);
@@ -411,6 +411,7 @@ void QDialogPrivate::hideDefault()
list.at(i)->setDefault(false);
}
}
+#endif
void QDialogPrivate::resetModalitySetByOpen()
{
@@ -644,6 +645,7 @@ void QDialog::keyPressEvent(QKeyEvent *e)
#endif
if (!e->modifiers() || (e->modifiers() & Qt::KeypadModifier && e->key() == Qt::Key_Enter)) {
switch (e->key()) {
+#if QT_CONFIG(pushbutton)
case Qt::Key_Enter:
case Qt::Key_Return: {
QList<QPushButton*> list = findChildren<QPushButton*>();
@@ -657,6 +659,7 @@ void QDialog::keyPressEvent(QKeyEvent *e)
}
}
break;
+#endif
default:
e->ignore();
return;
@@ -716,6 +719,7 @@ void QDialog::setVisible(bool visible)
and actually catches most cases... If not, then they simply
have to use [widget*]->setFocus() themselves...
*/
+#if QT_CONFIG(pushbutton)
if (d->mainDef && fw->focusPolicy() == Qt::NoFocus) {
QWidget *first = fw;
while ((first = first->nextInFocusChain()) != fw && first->focusPolicy() == Qt::NoFocus)
@@ -733,6 +737,7 @@ void QDialog::setVisible(bool visible)
}
}
}
+#endif
if (fw && !fw->hasFocus()) {
QFocusEvent e(QEvent::FocusIn, Qt::TabFocusReason);
QApplication::sendEvent(fw, &e);
@@ -760,10 +765,12 @@ void QDialog::setVisible(bool visible)
d->eventLoop->exit();
}
+#if QT_CONFIG(pushbutton)
const QPlatformTheme *theme = QGuiApplicationPrivate::platformTheme();
if (d->mainDef && isActiveWindow()
&& theme->themeHint(QPlatformTheme::DialogSnapToDefaultButton).toBool())
QCursor::setPos(d->mainDef->mapToGlobal(d->mainDef->rect().center()));
+#endif
}
/*!\reimp */
diff --git a/src/widgets/dialogs/qdialog_p.h b/src/widgets/dialogs/qdialog_p.h
index ae9e3bcc93..6723edae38 100644
--- a/src/widgets/dialogs/qdialog_p.h
+++ b/src/widgets/dialogs/qdialog_p.h
@@ -56,7 +56,9 @@
#include "QtCore/qeventloop.h"
#include "QtCore/qpointer.h"
#include "QtWidgets/qdialog.h"
+#if QT_CONFIG(pushbutton)
#include "QtWidgets/qpushbutton.h"
+#endif
#include <qpa/qplatformdialoghelper.h>
QT_BEGIN_NAMESPACE
@@ -69,7 +71,11 @@ class Q_WIDGETS_EXPORT QDialogPrivate : public QWidgetPrivate
public:
QDialogPrivate()
- : mainDef(0), orientation(Qt::Horizontal),extension(0), doShowExtension(false),
+ :
+#if QT_CONFIG(pushbutton)
+ mainDef(0),
+#endif
+ orientation(Qt::Horizontal),extension(0), doShowExtension(false),
#ifndef QT_NO_SIZEGRIP
resizer(0),
sizeGripEnabled(false),
@@ -84,7 +90,9 @@ public:
QVariant styleHint(QPlatformDialogHelper::StyleHint hint) const;
void deletePlatformHelper();
+#if QT_CONFIG(pushbutton)
QPointer<QPushButton> mainDef;
+#endif
Qt::Orientation orientation;
QWidget *extension;
bool doShowExtension;
@@ -95,9 +103,11 @@ public:
#endif
QPoint lastRMBPress;
+#if QT_CONFIG(pushbutton)
void setDefault(QPushButton *);
void setMainDefault(QPushButton *);
void hideDefault();
+#endif
void resetModalitySetByOpen();
int rescode;
diff --git a/src/widgets/styles/qfusionstyle.cpp b/src/widgets/styles/qfusionstyle.cpp
index cf393744f0..96af534099 100644
--- a/src/widgets/styles/qfusionstyle.cpp
+++ b/src/widgets/styles/qfusionstyle.cpp
@@ -43,7 +43,11 @@
#if QT_CONFIG(style_fusion) || defined(QT_PLUGIN)
#include "qcommonstyle_p.h"
#include <qcombobox.h>
+#if QT_CONFIG(pushbutton)
#include <qpushbutton.h>
+#else
+#include <qabstractbutton.h>
+#endif
#include <qpainter.h>
#include <qdir.h>
#include <qstyleoption.h>
diff --git a/src/widgets/styles/qmacstyle_mac.mm b/src/widgets/styles/qmacstyle_mac.mm
index 8aace93328..6dcebaaf32 100644
--- a/src/widgets/styles/qmacstyle_mac.mm
+++ b/src/widgets/styles/qmacstyle_mac.mm
@@ -75,7 +75,9 @@
#include <qpixmapcache.h>
#include <qpointer.h>
#include <qprogressbar.h>
+#if QT_CONFIG(pushbutton)
#include <qpushbutton.h>
+#endif
#include <qradiobutton.h>
#include <qrubberband.h>
#include <qscrollbar.h>
@@ -663,8 +665,10 @@ static QSize qt_aqua_get_known_size(QStyle::ContentsType ct, const QWidget *widg
}
if (ct == QStyle::CT_CustomBase && widg) {
+#if QT_CONFIG(pushbutton)
if (qobject_cast<const QPushButton *>(widg))
ct = QStyle::CT_PushButton;
+#endif
else if (qobject_cast<const QRadioButton *>(widg))
ct = QStyle::CT_RadioButton;
#if QT_CONFIG(checkbox)
@@ -704,6 +708,7 @@ static QSize qt_aqua_get_known_size(QStyle::ContentsType ct, const QWidget *widg
}
switch (ct) {
+#if QT_CONFIG(pushbutton)
case QStyle::CT_PushButton: {
const QPushButton *psh = qobject_cast<const QPushButton *>(widg);
// If this comparison is false, then the widget was not a push button.
@@ -746,6 +751,7 @@ static QSize qt_aqua_get_known_size(QStyle::ContentsType ct, const QWidget *widg
// Since there's no default size we return the large size...
ret = QSize(-1, qt_mac_aqua_get_metric(kThemeMetricPushButtonHeight));
}
+#endif
#if 0 //Not sure we are applying the rules correctly for RadioButtons/CheckBoxes --Sam
} else if (ct == QStyle::CT_RadioButton) {
QRadioButton *rdo = static_cast<QRadioButton *>(widg);
@@ -1308,6 +1314,7 @@ void QMacStylePrivate::initHIThemePushButton(const QStyleOptionButton *btn,
}
}
+#if QT_CONFIG(pushbutton)
bool qt_mac_buttonIsRenderedFlat(const QPushButton *pushButton, const QStyleOptionButton *option)
{
QMacStyle *macStyle = qobject_cast<QMacStyle *>(pushButton->style());
@@ -1317,6 +1324,7 @@ bool qt_mac_buttonIsRenderedFlat(const QPushButton *pushButton, const QStyleOpti
macStyle->d_func()->initHIThemePushButton(option, pushButton, kThemeStateActive, &bdi);
return bdi.kind == kThemeBevelButton;
}
+#endif
/**
Creates a HIThemeButtonDrawInfo structure that specifies the correct button
diff --git a/src/widgets/styles/qmacstyle_mac_p.h b/src/widgets/styles/qmacstyle_mac_p.h
index 98a9063bf0..7296539356 100644
--- a/src/widgets/styles/qmacstyle_mac_p.h
+++ b/src/widgets/styles/qmacstyle_mac_p.h
@@ -127,7 +127,9 @@ private:
Q_DISABLE_COPY(QMacStyle)
Q_DECLARE_PRIVATE(QMacStyle)
+#if QT_CONFIG(pushbutton)
friend bool qt_mac_buttonIsRenderedFlat(const QPushButton *pushButton, const QStyleOptionButton *option);
+#endif
};
#endif
diff --git a/src/widgets/styles/qmacstyle_mac_p_p.h b/src/widgets/styles/qmacstyle_mac_p_p.h
index 063d7e7c80..1332845f8e 100644
--- a/src/widgets/styles/qmacstyle_mac_p_p.h
+++ b/src/widgets/styles/qmacstyle_mac_p_p.h
@@ -78,7 +78,9 @@
#include <qpixmapcache.h>
#include <qpointer.h>
#include <qprogressbar.h>
+#if QT_CONFIG(pushbutton)
#include <qpushbutton.h>
+#endif
#include <qradiobutton.h>
#include <qrubberband.h>
#include <qsizegrip.h>
@@ -158,7 +160,9 @@ typedef void (^QCocoaDrawRectBlock)(NSRect, CGContextRef);
return sizes[controlSize]; \
} while (0)
+#if QT_CONFIG(pushbutton)
bool qt_mac_buttonIsRenderedFlat(const QPushButton *pushButton, const QStyleOptionButton *option);
+#endif
class QMacStylePrivate : public QCommonStylePrivate
{
diff --git a/src/widgets/styles/qwindowsvistastyle_p_p.h b/src/widgets/styles/qwindowsvistastyle_p_p.h
index 7173b2183c..ec7c2caad3 100644
--- a/src/widgets/styles/qwindowsvistastyle_p_p.h
+++ b/src/widgets/styles/qwindowsvistastyle_p_p.h
@@ -64,7 +64,9 @@
#include <qapplication.h>
#include <qpixmapcache.h>
#include <qstyleoption.h>
+#if QT_CONFIG(pushbutton)
#include <qpushbutton.h>
+#endif
#include <qradiobutton.h>
#include <qlineedit.h>
#include <qgroupbox.h>
diff --git a/src/widgets/styles/qwindowsxpstyle.cpp b/src/widgets/styles/qwindowsxpstyle.cpp
index f50c143a4a..f3c6069f8a 100644
--- a/src/widgets/styles/qwindowsxpstyle.cpp
+++ b/src/widgets/styles/qwindowsxpstyle.cpp
@@ -65,7 +65,9 @@
#include <qspinbox.h>
#include <qlistview.h>
#include <qstackedwidget.h>
+#if QT_CONFIG(pushbutton)
#include <qpushbutton.h>
+#endif
#include <qtoolbar.h>
#include <qlabel.h>
#include <qvarlengtharray.h>
diff --git a/src/widgets/util/qsystemtrayicon.cpp b/src/widgets/util/qsystemtrayicon.cpp
index 4ea776d0b1..1e0d2ab857 100644
--- a/src/widgets/util/qsystemtrayicon.cpp
+++ b/src/widgets/util/qsystemtrayicon.cpp
@@ -50,7 +50,9 @@
#include "qlabel.h"
#include "private/qlabel_p.h"
#endif
+#if QT_CONFIG(pushbutton)
#include "qpushbutton.h"
+#endif
#include "qpainterpath.h"
#include "qpainter.h"
#include "qstyle.h"
@@ -496,12 +498,14 @@ QBalloonTip::QBalloonTip(const QIcon &icon, const QString &title,
const int iconSize = 18;
const int closeButtonSize = 15;
+#if QT_CONFIG(pushbutton)
QPushButton *closeButton = new QPushButton;
closeButton->setIcon(style()->standardIcon(QStyle::SP_TitleBarCloseButton));
closeButton->setIconSize(QSize(closeButtonSize, closeButtonSize));
closeButton->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
closeButton->setFixedSize(closeButtonSize, closeButtonSize);
QObject::connect(closeButton, SIGNAL(clicked()), this, SLOT(close()));
+#endif
#if QT_CONFIG(label)
QLabel *msgLabel = new QLabel;
@@ -542,7 +546,10 @@ QBalloonTip::QBalloonTip(const QIcon &icon, const QString &title,
}
#endif
+#if QT_CONFIG(pushbutton)
layout->addWidget(closeButton, 0, 2);
+#endif
+
#if QT_CONFIG(label)
layout->addWidget(msgLabel, 1, 0, 1, 3);
#endif
diff --git a/src/widgets/widgets/qpushbutton.h b/src/widgets/widgets/qpushbutton.h
index b0d1ccacdb..ea9baa8ccb 100644
--- a/src/widgets/widgets/qpushbutton.h
+++ b/src/widgets/widgets/qpushbutton.h
@@ -43,6 +43,8 @@
#include <QtWidgets/qtwidgetsglobal.h>
#include <QtWidgets/qabstractbutton.h>
+QT_REQUIRE_CONFIG(pushbutton);
+
QT_BEGIN_NAMESPACE
diff --git a/src/widgets/widgets/qpushbutton_p.h b/src/widgets/widgets/qpushbutton_p.h
index ee41c345c8..198091503a 100644
--- a/src/widgets/widgets/qpushbutton_p.h
+++ b/src/widgets/widgets/qpushbutton_p.h
@@ -43,6 +43,8 @@
#include <QtWidgets/private/qtwidgetsglobal_p.h>
#include "private/qabstractbutton_p.h"
+QT_REQUIRE_CONFIG(pushbutton);
+
//
// W A R N I N G
// -------------
diff --git a/src/widgets/widgets/widgets.pri b/src/widgets/widgets/widgets.pri
index 2d082812b6..d25d8ce63e 100644
--- a/src/widgets/widgets/widgets.pri
+++ b/src/widgets/widgets/widgets.pri
@@ -38,8 +38,6 @@ HEADERS += \
widgets/qmenubar.h \
widgets/qmenubar_p.h \
widgets/qprogressbar.h \
- widgets/qpushbutton.h \
- widgets/qpushbutton_p.h \
widgets/qrubberband.h \
widgets/qscrollbar.h \
widgets/qscrollbar_p.h \
@@ -104,7 +102,6 @@ SOURCES += \
widgets/qmenu.cpp \
widgets/qmenubar.cpp \
widgets/qprogressbar.cpp \
- widgets/qpushbutton.cpp \
widgets/qrubberband.cpp \
widgets/qscrollbar.cpp \
widgets/qsizegrip.cpp \
@@ -159,6 +156,16 @@ qtConfig(label) {
widgets/qlabel.cpp
}
+
+qtConfig(pushbutton) {
+ HEADERS += \
+ widgets/qpushbutton.h \
+ widgets/qpushbutton_p.h
+
+ SOURCES += \
+ widgets/qpushbutton.cpp
+}
+
qtConfig(radiobutton) {
HEADERS += \
widgets/qradiobutton.h