Add feature.pushbutton
Change-Id: I654d91635e60b177df16f6dfe00acc940132f66a Reviewed-by: Lars Knoll <lars.knoll@qt.io>
This commit is contained in:
parent
0884e42410
commit
00e6863552
@ -207,7 +207,9 @@ QT_BEGIN_INCLUDE_NAMESPACE
|
||||
#include <qlabel.h>
|
||||
#include <qlayout.h>
|
||||
#include <qmessagebox.h>
|
||||
#if QT_CONFIG(pushbutton)
|
||||
#include <qpushbutton.h>
|
||||
#endif
|
||||
#include <qtimer.h>
|
||||
#include <qapplication.h>
|
||||
QT_END_INCLUDE_NAMESPACE
|
||||
|
@ -45,7 +45,6 @@
|
||||
#include "complexwidgets_p.h"
|
||||
#include "itemviews_p.h"
|
||||
|
||||
#include <qpushbutton.h>
|
||||
#include <qtoolbutton.h>
|
||||
#include <qtreeview.h>
|
||||
#include <qvariant.h>
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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": {
|
||||
|
@ -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 */
|
||||
|
@ -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;
|
||||
|
@ -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>
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
{
|
||||
|
@ -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>
|
||||
|
@ -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>
|
||||
|
@ -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
|
||||
|
@ -43,6 +43,8 @@
|
||||
#include <QtWidgets/qtwidgetsglobal.h>
|
||||
#include <QtWidgets/qabstractbutton.h>
|
||||
|
||||
QT_REQUIRE_CONFIG(pushbutton);
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
|
||||
|
@ -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
|
||||
// -------------
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user