Add feature.abstractbutton
Change-Id: Ie93c6d0a8256bc466d3419408b753d5f3738aa6b Reviewed-by: Lars Knoll <lars.knoll@qt.io>
This commit is contained in:
parent
f06f1adb6c
commit
d08deb0b4a
@ -41,7 +41,6 @@
|
||||
|
||||
#include <qaccessible.h>
|
||||
#include <qapplication.h>
|
||||
#include <qabstractbutton.h>
|
||||
#include <qevent.h>
|
||||
#include <qheaderview.h>
|
||||
#include <qtabbar.h>
|
||||
|
@ -103,11 +103,13 @@ QAccessibleInterface *qAccessibleFactory(const QString &classname, QObject *obje
|
||||
} else if (classname == QLatin1String("QToolButton")) {
|
||||
iface = new QAccessibleToolButton(widget);
|
||||
#endif // QT_NO_TOOLBUTTON
|
||||
#if QT_CONFIG(abstractbutton)
|
||||
} else if (classname == QLatin1String("QCheckBox")
|
||||
|| classname == QLatin1String("QRadioButton")
|
||||
|| classname == QLatin1String("QPushButton")
|
||||
|| classname == QLatin1String("QAbstractButton")) {
|
||||
iface = new QAccessibleButton(widget);
|
||||
#endif
|
||||
} else if (classname == QLatin1String("QDialog")) {
|
||||
iface = new QAccessibleWidget(widget, QAccessible::Dialog);
|
||||
} else if (classname == QLatin1String("QMessageBox")) {
|
||||
|
@ -64,7 +64,6 @@
|
||||
#include <QAbstractItemView>
|
||||
#include <QDockWidget>
|
||||
#include <QMainWindow>
|
||||
#include <QAbstractButton>
|
||||
#include <private/qdockwidget_p.h>
|
||||
#include <QFocusFrame>
|
||||
|
||||
|
@ -39,7 +39,9 @@
|
||||
|
||||
#include "simplewidgets_p.h"
|
||||
|
||||
#if QT_CONFIG(abstractbutton)
|
||||
#include <qabstractbutton.h>
|
||||
#endif
|
||||
#if QT_CONFIG(checkbox)
|
||||
#include <qcheckbox.h>
|
||||
#endif
|
||||
@ -80,6 +82,7 @@ extern QList<QWidget*> childWidgets(const QWidget *widget);
|
||||
QString qt_accStripAmp(const QString &text);
|
||||
QString qt_accHotKey(const QString &text);
|
||||
|
||||
#if QT_CONFIG(abstractbutton)
|
||||
/*!
|
||||
\class QAccessibleButton
|
||||
\brief The QAccessibleButton class implements the QAccessibleInterface for button type widgets.
|
||||
@ -267,7 +270,7 @@ QStringList QAccessibleButton::keyBindingsForAction(const QString &actionName) c
|
||||
}
|
||||
return QStringList();
|
||||
}
|
||||
|
||||
#endif // QT_CONFIG(abstractbutton)
|
||||
|
||||
#ifndef QT_NO_TOOLBUTTON
|
||||
/*!
|
||||
|
@ -65,6 +65,7 @@ class QToolButton;
|
||||
class QGroupBox;
|
||||
class QProgressBar;
|
||||
|
||||
#if QT_CONFIG(abstractbutton)
|
||||
class QAccessibleButton : public QAccessibleWidget
|
||||
{
|
||||
Q_DECLARE_TR_FUNCTIONS(QAccessibleButton)
|
||||
@ -83,6 +84,7 @@ public:
|
||||
protected:
|
||||
QAbstractButton *button() const;
|
||||
};
|
||||
#endif
|
||||
|
||||
#ifndef QT_NO_TOOLBUTTON
|
||||
class QAccessibleToolButton : public QAccessibleButton
|
||||
|
@ -117,6 +117,12 @@
|
||||
"condition": "features.tableview",
|
||||
"output": [ "publicFeature", "feature" ]
|
||||
},
|
||||
"abstractbutton": {
|
||||
"label": "QAbstractButton",
|
||||
"purpose": "Abstract base class of button widgets, providing functionality common to buttons.",
|
||||
"section": "Widgets",
|
||||
"output": [ "publicFeature" ]
|
||||
},
|
||||
"commandlinkbutton": {
|
||||
"label": "QCommandLinkButton",
|
||||
"purpose": "Provides a Vista style command link button.",
|
||||
@ -193,6 +199,7 @@
|
||||
"label": "QRadioButton",
|
||||
"purpose": "Provides a radio button with a text label.",
|
||||
"section": "Widgets",
|
||||
"condition": "features.abstractbutton",
|
||||
"output": [ "publicFeature" ]
|
||||
},
|
||||
"spinbox": {
|
||||
@ -234,20 +241,21 @@
|
||||
"label": "QCheckBox(",
|
||||
"purpose": "Provides a checkbox with a text label.",
|
||||
"section": "Widgets",
|
||||
"condition": "features.abstractbutton",
|
||||
"output": [ "publicFeature" ]
|
||||
},
|
||||
"pushbutton": {
|
||||
"label": "QPushButton",
|
||||
"purpose": "Provides a command button.",
|
||||
"section": "Widgets",
|
||||
"condition": "features.action",
|
||||
"condition": "features.abstractbutton && features.action",
|
||||
"output": [ "publicFeature" ]
|
||||
},
|
||||
"toolbutton": {
|
||||
"label": "QToolButton",
|
||||
"purpose": "Provides quick-access buttons to commands and options.",
|
||||
"section": "Widgets",
|
||||
"condition": "features.action",
|
||||
"condition": "features.abstractbutton && features.action",
|
||||
"output": [ "publicFeature", "feature" ]
|
||||
},
|
||||
"toolbar": {
|
||||
@ -274,7 +282,7 @@
|
||||
"label": "QButtonGroup",
|
||||
"purpose": "Supports organizing groups of button widgets.",
|
||||
"section": "Widgets",
|
||||
"condition": "features.groupbox",
|
||||
"condition": "features.abstractbutton && features.groupbox",
|
||||
"output": [ "publicFeature", "feature" ]
|
||||
},
|
||||
"mainwindow": {
|
||||
|
@ -49,7 +49,9 @@
|
||||
#include <qevent.h>
|
||||
#include <qbitarray.h>
|
||||
#include <qscrollbar.h>
|
||||
#if QT_CONFIG(abstractbutton)
|
||||
#include <qabstractbutton.h>
|
||||
#endif
|
||||
#include <private/qtableview_p.h>
|
||||
#include <private/qheaderview_p.h>
|
||||
#include <private/qscrollbar_p.h>
|
||||
@ -578,6 +580,7 @@ bool QSpanCollection::checkConsistency() const
|
||||
}
|
||||
#endif
|
||||
|
||||
#if QT_CONFIG(abstractbutton)
|
||||
class QTableCornerButton : public QAbstractButton
|
||||
{
|
||||
Q_OBJECT
|
||||
@ -600,6 +603,7 @@ public:
|
||||
style()->drawControl(QStyle::CE_Header, &opt, &painter, this);
|
||||
}
|
||||
};
|
||||
#endif
|
||||
|
||||
void QTableViewPrivate::init()
|
||||
{
|
||||
@ -619,9 +623,11 @@ void QTableViewPrivate::init()
|
||||
|
||||
tabKeyNavigation = true;
|
||||
|
||||
#if QT_CONFIG(abstractbutton)
|
||||
cornerWidget = new QTableCornerButton(q);
|
||||
cornerWidget->setFocusPolicy(Qt::NoFocus);
|
||||
QObject::connect(cornerWidget, SIGNAL(clicked()), q, SLOT(selectAll()));
|
||||
#endif
|
||||
}
|
||||
|
||||
/*!
|
||||
@ -2121,6 +2127,7 @@ void QTableView::updateGeometries()
|
||||
if (d->horizontalHeader->isHidden())
|
||||
QMetaObject::invokeMethod(d->horizontalHeader, "updateGeometries");
|
||||
|
||||
#if QT_CONFIG(abstractbutton)
|
||||
// update cornerWidget
|
||||
if (d->horizontalHeader->isHidden() || d->verticalHeader->isHidden()) {
|
||||
d->cornerWidget->setHidden(true);
|
||||
@ -2128,6 +2135,7 @@ void QTableView::updateGeometries()
|
||||
d->cornerWidget->setHidden(false);
|
||||
d->cornerWidget->setGeometry(verticalLeft, horizontalTop, width, height);
|
||||
}
|
||||
#endif
|
||||
|
||||
// update scroll bars
|
||||
|
||||
@ -2642,6 +2650,7 @@ bool QTableView::wordWrap() const
|
||||
return d->wrapItemText;
|
||||
}
|
||||
|
||||
#if QT_CONFIG(abstractbutton)
|
||||
/*!
|
||||
\property QTableView::cornerButtonEnabled
|
||||
\brief whether the button in the top-left corner is enabled
|
||||
@ -2664,6 +2673,7 @@ bool QTableView::isCornerButtonEnabled() const
|
||||
Q_D(const QTableView);
|
||||
return d->cornerWidget->isEnabled();
|
||||
}
|
||||
#endif
|
||||
|
||||
/*!
|
||||
\internal
|
||||
|
@ -58,7 +58,9 @@ class Q_WIDGETS_EXPORT QTableView : public QAbstractItemView
|
||||
Q_PROPERTY(Qt::PenStyle gridStyle READ gridStyle WRITE setGridStyle)
|
||||
Q_PROPERTY(bool sortingEnabled READ isSortingEnabled WRITE setSortingEnabled)
|
||||
Q_PROPERTY(bool wordWrap READ wordWrap WRITE setWordWrap)
|
||||
#if QT_CONFIG(abstractbutton)
|
||||
Q_PROPERTY(bool cornerButtonEnabled READ isCornerButtonEnabled WRITE setCornerButtonEnabled)
|
||||
#endif
|
||||
|
||||
public:
|
||||
explicit QTableView(QWidget *parent = Q_NULLPTR);
|
||||
@ -103,8 +105,10 @@ public:
|
||||
void setWordWrap(bool on);
|
||||
bool wordWrap() const;
|
||||
|
||||
#if QT_CONFIG(abstractbutton)
|
||||
void setCornerButtonEnabled(bool enable);
|
||||
bool isCornerButtonEnabled() const;
|
||||
#endif
|
||||
|
||||
QRect visualRect(const QModelIndex &index) const Q_DECL_OVERRIDE;
|
||||
void scrollTo(const QModelIndex &index, ScrollHint hint = EnsureVisible) Q_DECL_OVERRIDE;
|
||||
|
@ -192,7 +192,9 @@ public:
|
||||
QVector<int> rowsToUpdate;
|
||||
QHeaderView *horizontalHeader;
|
||||
QHeaderView *verticalHeader;
|
||||
#if QT_CONFIG(abstractbutton)
|
||||
QWidget *cornerWidget;
|
||||
#endif
|
||||
bool sortingEnabled;
|
||||
bool geometryRecursionBlock;
|
||||
QPoint visualCursor; // (Row,column) cell coordinates to track through span navigation.
|
||||
|
@ -45,7 +45,8 @@
|
||||
#include <qcombobox.h>
|
||||
#if QT_CONFIG(pushbutton)
|
||||
#include <qpushbutton.h>
|
||||
#else
|
||||
#endif
|
||||
#if QT_CONFIG(abstractbutton)
|
||||
#include <qabstractbutton.h>
|
||||
#endif
|
||||
#include <qpainter.h>
|
||||
@ -3284,7 +3285,10 @@ void QFusionStyle::polish(QApplication *app)
|
||||
void QFusionStyle::polish(QWidget *widget)
|
||||
{
|
||||
QCommonStyle::polish(widget);
|
||||
if (qobject_cast<QAbstractButton*>(widget)
|
||||
if (false
|
||||
#if QT_CONFIG(abstractbutton)
|
||||
|| qobject_cast<QAbstractButton*>(widget)
|
||||
#endif
|
||||
#if QT_CONFIG(combobox)
|
||||
|| qobject_cast<QComboBox *>(widget)
|
||||
#endif
|
||||
@ -3325,7 +3329,10 @@ void QFusionStyle::polish(QPalette &pal)
|
||||
void QFusionStyle::unpolish(QWidget *widget)
|
||||
{
|
||||
QCommonStyle::unpolish(widget);
|
||||
if (qobject_cast<QAbstractButton*>(widget)
|
||||
if (false
|
||||
#if QT_CONFIG(abstractbutton)
|
||||
|| qobject_cast<QAbstractButton*>(widget)
|
||||
#endif
|
||||
#if QT_CONFIG(combobox)
|
||||
|| qobject_cast<QComboBox *>(widget)
|
||||
#endif
|
||||
|
@ -4268,6 +4268,7 @@ void QStyleSheetStyle::drawPrimitive(PrimitiveElement pe, const QStyleOption *op
|
||||
|
||||
case PE_PanelButtonTool:
|
||||
case PE_PanelButtonCommand:
|
||||
#if QT_CONFIG(abstractbutton)
|
||||
if (qobject_cast<const QAbstractButton *>(w) && rule.hasBackground() && rule.hasNativeBorder()) {
|
||||
//the window style will draw the borders
|
||||
ParentStyle::drawPrimitive(pe, opt, p, w);
|
||||
@ -4276,6 +4277,7 @@ void QStyleSheetStyle::drawPrimitive(PrimitiveElement pe, const QStyleOption *op
|
||||
}
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
if (!rule.hasNativeBorder()) {
|
||||
rule.drawRule(p, rule.boxRect(opt->rect, QRenderRule::Margin));
|
||||
return;
|
||||
|
@ -1139,7 +1139,10 @@ void QWindowsXPStyle::polish(QWidget *widget)
|
||||
if (!QWindowsXPStylePrivate::useXP())
|
||||
return;
|
||||
|
||||
if (qobject_cast<QAbstractButton*>(widget)
|
||||
if (false
|
||||
#if QT_CONFIG(abstractbutton)
|
||||
|| qobject_cast<QAbstractButton*>(widget)
|
||||
#endif
|
||||
|| qobject_cast<QToolButton*>(widget)
|
||||
|| qobject_cast<QTabBar*>(widget)
|
||||
#ifndef QT_NO_COMBOBOX
|
||||
@ -1211,7 +1214,10 @@ void QWindowsXPStyle::unpolish(QWidget *widget)
|
||||
// already in the map might be old (other style).
|
||||
d->cleanupHandleMap();
|
||||
}
|
||||
if (qobject_cast<QAbstractButton*>(widget)
|
||||
if (false
|
||||
#if QT_CONFIG(abstractbutton)
|
||||
|| qobject_cast<QAbstractButton*>(widget)
|
||||
#endif
|
||||
|| qobject_cast<QToolButton*>(widget)
|
||||
|| qobject_cast<QTabBar*>(widget)
|
||||
#ifndef QT_NO_COMBOBOX
|
||||
|
@ -45,6 +45,8 @@
|
||||
#include <QtGui/qkeysequence.h>
|
||||
#include <QtWidgets/qwidget.h>
|
||||
|
||||
QT_REQUIRE_CONFIG(abstractbutton);
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
|
||||
|
@ -41,7 +41,9 @@
|
||||
#include "qevent.h"
|
||||
#include "qdrawutil.h"
|
||||
#include "qapplication.h"
|
||||
#if QT_CONFIG(abstractbutton)
|
||||
#include "qabstractbutton.h"
|
||||
#endif
|
||||
#include "qstyle.h"
|
||||
#include "qstyleoption.h"
|
||||
#include <limits.h>
|
||||
@ -972,12 +974,14 @@ bool QLabel::event(QEvent *e)
|
||||
QShortcutEvent *se = static_cast<QShortcutEvent *>(e);
|
||||
if (se->shortcutId() == d->shortcutId) {
|
||||
QWidget * w = d->buddy;
|
||||
QAbstractButton *button = qobject_cast<QAbstractButton *>(w);
|
||||
if (w->focusPolicy() != Qt::NoFocus)
|
||||
w->setFocus(Qt::ShortcutFocusReason);
|
||||
#if QT_CONFIG(abstractbutton)
|
||||
QAbstractButton *button = qobject_cast<QAbstractButton *>(w);
|
||||
if (button && !se->isAmbiguous())
|
||||
button->animateClick();
|
||||
else
|
||||
#endif
|
||||
window()->setAttribute(Qt::WA_KeyboardFocusChange);
|
||||
return true;
|
||||
}
|
||||
|
@ -41,13 +41,14 @@
|
||||
#define QTOOLBUTTON_H
|
||||
|
||||
#include <QtWidgets/qtwidgetsglobal.h>
|
||||
|
||||
#if QT_CONFIG(toolbutton)
|
||||
|
||||
#include <QtWidgets/qabstractbutton.h>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
|
||||
#ifndef QT_NO_TOOLBUTTON
|
||||
|
||||
class QToolButtonPrivate;
|
||||
class QMenu;
|
||||
class QStyleOptionToolButton;
|
||||
@ -134,8 +135,8 @@ private:
|
||||
|
||||
};
|
||||
|
||||
#endif // QT_NO_TOOLBUTTON
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
#endif // QT_CONFIG(toolbutton)
|
||||
|
||||
#endif // QTOOLBUTTON_H
|
||||
|
@ -3,8 +3,6 @@
|
||||
HEADERS += \
|
||||
widgets/qbuttongroup.h \
|
||||
widgets/qbuttongroup_p.h \
|
||||
widgets/qabstractbutton.h \
|
||||
widgets/qabstractbutton_p.h \
|
||||
widgets/qabstractspinbox.h \
|
||||
widgets/qabstractspinbox_p.h \
|
||||
widgets/qcalendarwidget.h \
|
||||
@ -76,7 +74,6 @@ HEADERS += \
|
||||
|
||||
SOURCES += \
|
||||
widgets/qbuttongroup.cpp \
|
||||
widgets/qabstractbutton.cpp \
|
||||
widgets/qabstractspinbox.cpp \
|
||||
widgets/qcalendarwidget.cpp \
|
||||
widgets/qcombobox.cpp \
|
||||
@ -128,6 +125,15 @@ SOURCES += \
|
||||
widgets/qtoolbararealayout.cpp \
|
||||
widgets/qplaintextedit.cpp
|
||||
|
||||
qtConfig(abstractbutton) {
|
||||
HEADERS += \
|
||||
widgets/qabstractbutton.h \
|
||||
widgets/qabstractbutton_p.h
|
||||
|
||||
SOURCES += \
|
||||
widgets/qabstractbutton.cpp
|
||||
}
|
||||
|
||||
qtConfig(abstractslider) {
|
||||
HEADERS += \
|
||||
widgets/qabstractslider.h \
|
||||
|
Loading…
x
Reference in New Issue
Block a user