QAction: Properly port to the new configure system
Use QT_REQUIRE_CONFIG in the headers of classes to be disabled. Add headers/source files in the .pro file depending on the configure feature in libraries and tests. Add the necessary exclusions and use QT_CONFIG. Only the widgets/kernel tests were made to compile since also the buttons depend on the action feature and it would become too involved. Task-number: QTBUG-69478 Change-Id: Id5bf88bc108f2bbb14dce8625bfdcb7eb0deb8e3 Reviewed-by: Oliver Wolff <oliver.wolff@qt.io> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
This commit is contained in:
parent
c92cb78b6d
commit
5367f76e17
@ -1638,8 +1638,8 @@
|
||||
"output": [ "publicFeature", "feature" ]
|
||||
},
|
||||
"action": {
|
||||
"label": "QAction",
|
||||
"purpose": "Provides widget actions.",
|
||||
"label": "Q(Gui)Action(Group)",
|
||||
"purpose": "Provides abstract user interface actions.",
|
||||
"section": "Kernel",
|
||||
"output": [ "publicFeature", "feature" ]
|
||||
},
|
||||
|
@ -753,7 +753,7 @@ private:
|
||||
};
|
||||
#endif
|
||||
|
||||
#ifndef QT_NO_ACTION
|
||||
#if QT_CONFIG(action)
|
||||
class Q_GUI_EXPORT QActionEvent : public QEvent
|
||||
{
|
||||
QGuiAction *act, *bef;
|
||||
@ -764,7 +764,7 @@ public:
|
||||
inline QGuiAction *action() const { return act; }
|
||||
inline QGuiAction *before() const { return bef; }
|
||||
};
|
||||
#endif
|
||||
#endif // QT_CONFIG(action)
|
||||
|
||||
class Q_GUI_EXPORT QFileOpenEvent : public QEvent
|
||||
{
|
||||
|
@ -41,7 +41,6 @@
|
||||
|
||||
#ifndef QT_NO_ACCESSIBILITY
|
||||
|
||||
#include "qaction.h"
|
||||
#include "qapplication.h"
|
||||
#if QT_CONFIG(groupbox)
|
||||
#include "qgroupbox.h"
|
||||
|
@ -42,7 +42,9 @@
|
||||
|
||||
#include <QtWidgets/qtwidgetsglobal.h>
|
||||
#include <QtGui/qfont.h>
|
||||
#include <QtWidgets/qaction.h>
|
||||
#if QT_CONFIG(action)
|
||||
# include <QtWidgets/qaction.h>
|
||||
#endif
|
||||
#include <QtWidgets/qgraphicslayoutitem.h>
|
||||
#include <QtWidgets/qgraphicsitem.h>
|
||||
#include <QtGui/qpalette.h>
|
||||
|
@ -7,9 +7,6 @@ KERNEL_P= kernel
|
||||
HEADERS += \
|
||||
kernel/qtwidgetsglobal.h \
|
||||
kernel/qtwidgetsglobal_p.h \
|
||||
kernel/qaction.h \
|
||||
kernel/qaction_p.h \
|
||||
kernel/qactiongroup.h \
|
||||
kernel/qapplication.h \
|
||||
kernel/qapplication_p.h \
|
||||
kernel/qwidgetrepaintmanager_p.h \
|
||||
@ -24,8 +21,6 @@ HEADERS += \
|
||||
kernel/qstackedlayout.h \
|
||||
kernel/qwidget.h \
|
||||
kernel/qwidget_p.h \
|
||||
kernel/qwidgetaction.h \
|
||||
kernel/qwidgetaction_p.h \
|
||||
kernel/qgesture.h \
|
||||
kernel/qgesture_p.h \
|
||||
kernel/qstandardgestures_p.h \
|
||||
@ -37,8 +32,6 @@ HEADERS += \
|
||||
kernel/qtestsupport_widgets.h
|
||||
|
||||
SOURCES += \
|
||||
kernel/qaction.cpp \
|
||||
kernel/qactiongroup.cpp \
|
||||
kernel/qapplication.cpp \
|
||||
kernel/qwidgetrepaintmanager.cpp \
|
||||
kernel/qboxlayout.cpp \
|
||||
@ -49,7 +42,6 @@ SOURCES += \
|
||||
kernel/qsizepolicy.cpp \
|
||||
kernel/qstackedlayout.cpp \
|
||||
kernel/qwidget.cpp \
|
||||
kernel/qwidgetaction.cpp \
|
||||
kernel/qgesture.cpp \
|
||||
kernel/qstandardgestures.cpp \
|
||||
kernel/qgesturerecognizer.cpp \
|
||||
@ -65,6 +57,17 @@ macx: {
|
||||
SOURCES += kernel/qmacgesturerecognizer.cpp
|
||||
}
|
||||
|
||||
qtConfig(action) {
|
||||
HEADERS += kernel/qaction.h \
|
||||
kernel/qaction_p.h \
|
||||
kernel/qactiongroup.h \
|
||||
kernel/qwidgetaction.h \
|
||||
kernel/qwidgetaction_p.h
|
||||
SOURCES += kernel/qaction.cpp \
|
||||
kernel/qactiongroup.cpp \
|
||||
kernel/qwidgetaction.cpp
|
||||
}
|
||||
|
||||
qtConfig(opengl) {
|
||||
HEADERS += kernel/qopenglwidget.h
|
||||
SOURCES += kernel/qopenglwidget.cpp
|
||||
|
@ -40,7 +40,6 @@
|
||||
#include "qaction.h"
|
||||
#include "qactiongroup.h"
|
||||
|
||||
#ifndef QT_NO_ACTION
|
||||
#include "qaction_p.h"
|
||||
#include "qapplication.h"
|
||||
#include "qevent.h"
|
||||
@ -353,5 +352,3 @@ QAction::showStatusText(QWidget *widget)
|
||||
}
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
#endif // QT_NO_ACTION
|
||||
|
@ -46,11 +46,10 @@
|
||||
#include <QtWidgets/qwidget.h>
|
||||
#include <QtCore/qvariant.h>
|
||||
|
||||
QT_REQUIRE_CONFIG(action);
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
|
||||
#ifndef QT_NO_ACTION
|
||||
|
||||
class QMenu;
|
||||
class QActionGroup;
|
||||
class QActionPrivate;
|
||||
@ -108,8 +107,6 @@ QT_BEGIN_INCLUDE_NAMESPACE
|
||||
#include <QtWidgets/qactiongroup.h>
|
||||
QT_END_INCLUDE_NAMESPACE
|
||||
|
||||
#endif // QT_NO_ACTION
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
#endif // QACTION_H
|
||||
|
@ -40,8 +40,6 @@
|
||||
#include "qactiongroup.h"
|
||||
#include <QtGui/private/qguiactiongroup_p.h>
|
||||
|
||||
#ifndef QT_NO_ACTION
|
||||
|
||||
#include "qaction.h"
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
@ -188,5 +186,3 @@ QList<QAction*> QActionGroup::actions() const
|
||||
}
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
#endif // QT_NO_ACTION
|
||||
|
@ -44,11 +44,10 @@
|
||||
#include <QtGui/qguiactiongroup.h>
|
||||
#include <QtWidgets/qaction.h>
|
||||
|
||||
QT_REQUIRE_CONFIG(action);
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
|
||||
#ifndef QT_NO_ACTION
|
||||
|
||||
class QActionGroupPrivate;
|
||||
|
||||
class Q_WIDGETS_EXPORT QActionGroup : public QGuiActionGroup
|
||||
@ -76,8 +75,6 @@ private:
|
||||
Q_DISABLE_COPY(QActionGroup)
|
||||
};
|
||||
|
||||
#endif // QT_NO_ACTION
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
#endif // QACTIONGROUP_H
|
||||
|
@ -53,7 +53,9 @@
|
||||
#include <qapplication.h>
|
||||
#include <private/qapplication_p.h>
|
||||
#include <private/qshortcutmap_p.h>
|
||||
#include <private/qaction_p.h>
|
||||
#if QT_CONFIG(action)
|
||||
# include <private/qaction_p.h>
|
||||
#endif
|
||||
#include <private/qwidgetwindow_p.h>
|
||||
#include <qpa/qplatformmenu.h>
|
||||
|
||||
@ -70,7 +72,7 @@ static bool correctWidgetContext(Qt::ShortcutContext context, QWidget *w, QWidge
|
||||
#if QT_CONFIG(graphicsview)
|
||||
static bool correctGraphicsWidgetContext(Qt::ShortcutContext context, QGraphicsWidget *w, QWidget *active_window);
|
||||
#endif
|
||||
#ifndef QT_NO_ACTION
|
||||
#if QT_CONFIG(action)
|
||||
static bool correctActionContext(Qt::ShortcutContext context, QAction *a, QWidget *active_window);
|
||||
#endif
|
||||
|
||||
@ -107,7 +109,7 @@ bool qWidgetShortcutContextMatcher(QObject *object, Qt::ShortcutContext context)
|
||||
if (!active_window)
|
||||
return false;
|
||||
|
||||
#ifndef QT_NO_ACTION
|
||||
#if QT_CONFIG(action)
|
||||
if (auto a = qobject_cast<QAction *>(object))
|
||||
return correctActionContext(context, a, active_window);
|
||||
#endif
|
||||
@ -283,7 +285,7 @@ static bool correctGraphicsWidgetContext(Qt::ShortcutContext context, QGraphicsW
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef QT_NO_ACTION
|
||||
#if QT_CONFIG(action)
|
||||
static bool correctActionContext(Qt::ShortcutContext context, QAction *a, QWidget *active_window)
|
||||
{
|
||||
const QWidgetList &widgets = static_cast<QActionPrivate *>(QObjectPrivate::get(a))->widgets;
|
||||
@ -331,7 +333,7 @@ static bool correctActionContext(Qt::ShortcutContext context, QAction *a, QWidge
|
||||
#endif
|
||||
return false;
|
||||
}
|
||||
#endif // QT_NO_ACTION
|
||||
#endif // QT_CONFIG(action)
|
||||
|
||||
|
||||
/*!
|
||||
|
@ -53,7 +53,9 @@
|
||||
#include <qabstractbutton.h>
|
||||
#include <qabstractscrollarea.h>
|
||||
#include <qabstractslider.h>
|
||||
#include <qaction.h>
|
||||
#if QT_CONFIG(action)
|
||||
# include <qaction.h>
|
||||
#endif
|
||||
#include <qcommonstyle.h>
|
||||
#include <qlayout.h>
|
||||
#include <qstyle.h>
|
||||
|
@ -88,7 +88,9 @@
|
||||
|
||||
#include "qwidget_p.h"
|
||||
#include <QtGui/private/qwindow_p.h>
|
||||
#include "qaction_p.h"
|
||||
#if QT_CONFIG(action)
|
||||
# include "qaction_p.h"
|
||||
#endif
|
||||
#include "qlayout_p.h"
|
||||
#if QT_CONFIG(graphicsview)
|
||||
#include "QtWidgets/qgraphicsproxywidget.h"
|
||||
|
@ -40,7 +40,6 @@
|
||||
#include "qwidgetaction.h"
|
||||
#include "qdebug.h"
|
||||
|
||||
#ifndef QT_NO_ACTION
|
||||
#include "qwidgetaction_p.h"
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
@ -282,5 +281,3 @@ QList<QWidget *> QWidgetAction::createdWidgets() const
|
||||
QT_END_NAMESPACE
|
||||
|
||||
#include "moc_qwidgetaction.cpp"
|
||||
|
||||
#endif // QT_NO_ACTION
|
||||
|
@ -43,11 +43,10 @@
|
||||
#include <QtWidgets/qtwidgetsglobal.h>
|
||||
#include <QtWidgets/qaction.h>
|
||||
|
||||
QT_REQUIRE_CONFIG(action);
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
|
||||
#ifndef QT_NO_ACTION
|
||||
|
||||
class QWidgetActionPrivate;
|
||||
|
||||
class Q_WIDGETS_EXPORT QWidgetAction : public QAction
|
||||
@ -78,8 +77,6 @@ private:
|
||||
friend class QToolBar;
|
||||
};
|
||||
|
||||
#endif // QT_NO_ACTION
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
#endif // QWIDGETACTION_H
|
||||
|
@ -54,6 +54,8 @@
|
||||
#include <QtWidgets/private/qtwidgetsglobal_p.h>
|
||||
#include "private/qaction_p.h"
|
||||
|
||||
QT_REQUIRE_CONFIG(action);
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
class QWidgetActionPrivate : public QActionPrivate
|
||||
|
@ -443,7 +443,7 @@ const QUndoCommand *QUndoCommand::child(int index) const
|
||||
\sa QUndoCommand, QUndoView
|
||||
*/
|
||||
|
||||
#ifndef QT_NO_ACTION
|
||||
#if QT_CONFIG(action)
|
||||
|
||||
QUndoAction::QUndoAction(const QString &prefix, QObject *parent)
|
||||
: QAction(parent)
|
||||
@ -473,7 +473,7 @@ void QUndoAction::setTextFormat(const QString &textFormat, const QString &defaul
|
||||
m_defaultText = defaultText;
|
||||
}
|
||||
|
||||
#endif // QT_NO_ACTION
|
||||
#endif // QT_CONFIG(action)
|
||||
|
||||
/*! \internal
|
||||
Sets the current index to \a idx, emitting appropriate signals. If \a clean is true,
|
||||
|
@ -44,7 +44,9 @@
|
||||
#include <private/qobject_p.h>
|
||||
#include <QtCore/qlist.h>
|
||||
#include <QtCore/qstring.h>
|
||||
#include <QtWidgets/qaction.h>
|
||||
#if QT_CONFIG(action)
|
||||
# include <QtWidgets/qaction.h>
|
||||
#endif
|
||||
|
||||
#include "qundostack.h"
|
||||
|
||||
|
@ -52,7 +52,6 @@
|
||||
#include "qpainter.h"
|
||||
#include "qapplication.h"
|
||||
#include "qstyle.h"
|
||||
#include "qaction.h"
|
||||
#ifndef QT_NO_ACCESSIBILITY
|
||||
#include "qaccessible.h"
|
||||
#endif
|
||||
|
@ -47,7 +47,6 @@
|
||||
#include "qstyle.h"
|
||||
#include "qstyleoption.h"
|
||||
#include <limits.h>
|
||||
#include "qaction.h"
|
||||
#include "qclipboard.h"
|
||||
#include <qdebug.h>
|
||||
#include <qurl.h>
|
||||
|
@ -40,7 +40,9 @@
|
||||
#include "qlineedit.h"
|
||||
#include "qlineedit_p.h"
|
||||
|
||||
#include "qaction.h"
|
||||
#if QT_CONFIG(action)
|
||||
# include "qaction.h"
|
||||
#endif
|
||||
#include "qapplication.h"
|
||||
#include "qclipboard.h"
|
||||
#if QT_CONFIG(draganddrop)
|
||||
|
@ -47,7 +47,9 @@
|
||||
#if QT_CONFIG(draganddrop)
|
||||
#include "qdrag.h"
|
||||
#endif
|
||||
#include "qwidgetaction.h"
|
||||
#if QT_CONFIG(action)
|
||||
# include "qwidgetaction.h"
|
||||
#endif
|
||||
#include "qclipboard.h"
|
||||
#ifndef QT_NO_ACCESSIBILITY
|
||||
#include "qaccessible.h"
|
||||
@ -545,6 +547,7 @@ void QLineEditPrivate::positionSideWidgets()
|
||||
}
|
||||
}
|
||||
|
||||
#if QT_CONFIG(action)
|
||||
QLineEditPrivate::SideWidgetLocation QLineEditPrivate::findSideWidget(const QGuiAction *a) const
|
||||
{
|
||||
int i = 0;
|
||||
@ -574,12 +577,10 @@ QWidget *QLineEditPrivate::addAction(QAction *newAction, QAction *before, QLineE
|
||||
QWidget *w = 0;
|
||||
// Store flags about QWidgetAction here since removeAction() may be called from ~QAction,
|
||||
// in which a qobject_cast<> no longer works.
|
||||
#if QT_CONFIG(action)
|
||||
if (QWidgetAction *widgetAction = qobject_cast<QWidgetAction *>(newAction)) {
|
||||
if ((w = widgetAction->requestWidget(q)))
|
||||
flags |= SideWidgetCreatedByWidgetAction;
|
||||
}
|
||||
#endif
|
||||
if (!w) {
|
||||
#if QT_CONFIG(toolbutton)
|
||||
QLineEditIconButton *toolButton = new QLineEditIconButton(q);
|
||||
@ -636,7 +637,6 @@ QWidget *QLineEditPrivate::addAction(QAction *newAction, QAction *before, QLineE
|
||||
|
||||
void QLineEditPrivate::removeAction(QGuiAction *action)
|
||||
{
|
||||
#if QT_CONFIG(action)
|
||||
Q_Q(QLineEdit);
|
||||
const auto location = findSideWidget(action);
|
||||
if (!location.isValid())
|
||||
@ -652,10 +652,8 @@ void QLineEditPrivate::removeAction(QGuiAction *action)
|
||||
if (!hasSideWidgets()) // Last widget, remove connection
|
||||
QObject::disconnect(q, SIGNAL(textChanged(QString)), q, SLOT(_q_textChanged(QString)));
|
||||
q->update();
|
||||
#else
|
||||
Q_UNUSED(action);
|
||||
#endif // QT_CONFIG(action)
|
||||
}
|
||||
#endif // QT_CONFIG(action)
|
||||
|
||||
static int effectiveTextMargin(int defaultMargin, const QLineEditPrivate::SideWidgetEntryList &widgets,
|
||||
const QLineEditPrivate::SideWidgetParameters ¶meters)
|
||||
|
@ -238,8 +238,10 @@ public:
|
||||
|
||||
QString placeholderText;
|
||||
|
||||
#if QT_CONFIG(action)
|
||||
QWidget *addAction(QAction *newAction, QAction *before, QLineEdit::ActionPosition, int flags = 0);
|
||||
void removeAction(QGuiAction *action);
|
||||
#endif
|
||||
SideWidgetParameters sideWidgetParameters() const;
|
||||
QIcon clearButtonIcon() const;
|
||||
void setClearButtonEnabled(bool enabled);
|
||||
@ -261,7 +263,9 @@ private:
|
||||
};
|
||||
friend class QTypeInfo<SideWidgetLocation>;
|
||||
|
||||
#if QT_CONFIG(action)
|
||||
SideWidgetLocation findSideWidget(const QGuiAction *a) const;
|
||||
#endif
|
||||
|
||||
SideWidgetEntryList leadingSideWidgets;
|
||||
SideWidgetEntryList trailingSideWidgets;
|
||||
|
@ -162,7 +162,9 @@
|
||||
#include <QDebug>
|
||||
#include <QMdiArea>
|
||||
#include <QScopedValueRollback>
|
||||
#include <QAction>
|
||||
#if QT_CONFIG(action)
|
||||
# include <qaction.h>
|
||||
#endif
|
||||
#if QT_CONFIG(menu)
|
||||
#include <QMenu>
|
||||
#endif
|
||||
@ -895,7 +897,7 @@ QMdiSubWindowPrivate::QMdiSubWindowPrivate()
|
||||
*/
|
||||
void QMdiSubWindowPrivate::_q_updateStaysOnTopHint()
|
||||
{
|
||||
#ifndef QT_NO_ACTION
|
||||
#if QT_CONFIG(action)
|
||||
Q_Q(QMdiSubWindow);
|
||||
if (QAction *senderAction = qobject_cast<QAction *>(q->sender())) {
|
||||
if (senderAction->isChecked()) {
|
||||
@ -906,7 +908,7 @@ void QMdiSubWindowPrivate::_q_updateStaysOnTopHint()
|
||||
q->lower();
|
||||
}
|
||||
}
|
||||
#endif // QT_NO_ACTION
|
||||
#endif // QT_CONFIG(action)
|
||||
}
|
||||
|
||||
/*!
|
||||
|
@ -1,7 +1,5 @@
|
||||
TEMPLATE=subdirs
|
||||
SUBDIRS=\
|
||||
qaction \
|
||||
qactiongroup \
|
||||
qapplication \
|
||||
qboxlayout \
|
||||
qdesktopwidget \
|
||||
@ -13,7 +11,6 @@ SUBDIRS=\
|
||||
qtooltip \
|
||||
qwidget \
|
||||
qwidget_window \
|
||||
qwidgetaction \
|
||||
qwidgetmetatype \
|
||||
qwidgetsvariant \
|
||||
qwindowcontainer \
|
||||
@ -23,5 +20,10 @@ SUBDIRS=\
|
||||
darwin:SUBDIRS -= \ # Uses native recognizers
|
||||
qgesturerecognizer \
|
||||
|
||||
!qtConfig(action):SUBDIRS -= \
|
||||
qaction \
|
||||
qactiongroup \
|
||||
qwidgetaction
|
||||
|
||||
!qtConfig(shortcut): SUBDIRS -= \
|
||||
qshortcut
|
||||
|
Loading…
Reference in New Issue
Block a user