Skip to content

Commit

Permalink
Convert features.menu to QT_[REQUIRE_]CONFIG
Browse files Browse the repository at this point in the history
Change-Id: I031356411294b259ebd2b22c53159c93fd92af6e
Reviewed-by: Oswald Buddenhagen <[email protected]>
  • Loading branch information
sbinner committed Sep 19, 2017
1 parent 9833e68 commit 6d699d0
Show file tree
Hide file tree
Showing 55 changed files with 184 additions and 116 deletions.
6 changes: 4 additions & 2 deletions src/widgets/accessible/qaccessiblemenu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,9 @@

#include "qaccessiblemenu_p.h"

#if QT_CONFIG(menu)
#include <qmenu.h>
#endif
#if QT_CONFIG(menubar)
#include <qmenubar.h>
#endif
Expand All @@ -50,7 +52,7 @@

QT_BEGIN_NAMESPACE

#ifndef QT_NO_MENU
#if QT_CONFIG(menu)

QString qt_accStripAmp(const QString &text);
QString qt_accHotKey(const QString &text);
Expand Down Expand Up @@ -389,7 +391,7 @@ QWidget *QAccessibleMenuItem::owner() const
return m_owner;
}

#endif // QT_NO_MENU
#endif // QT_CONFIG(menu)

QT_END_NAMESPACE

Expand Down
4 changes: 2 additions & 2 deletions src/widgets/accessible/qaccessiblemenu_p.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ QT_BEGIN_NAMESPACE

#ifndef QT_NO_ACCESSIBILITY

#ifndef QT_NO_MENU
#if QT_CONFIG(menu)
class QMenu;
class QMenuBar;
class QAction;
Expand Down Expand Up @@ -136,7 +136,7 @@ class QAccessibleMenuItem : public QAccessibleInterface, public QAccessibleActio
QPointer<QWidget> m_owner; // can hold either QMenu or the QMenuBar that contains the action
};

#endif // QT_NO_MENU
#endif // QT_CONFIG(menu)

QT_END_NAMESPACE
#endif // QT_NO_ACCESSIBILITY
Expand Down
4 changes: 3 additions & 1 deletion src/widgets/accessible/qaccessiblewidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,9 @@
#include <QRubberBand>
#endif
#include <QFocusFrame>
#if QT_CONFIG(menu)
#include <QMenu>
#endif
#include <QtWidgets/private/qwidget_p.h>

QT_BEGIN_NAMESPACE
Expand All @@ -72,7 +74,7 @@ static QList<QWidget*> childWidgets(const QWidget *widget)
QWidget *w = qobject_cast<QWidget *>(o);
if (w && !w->isWindow()
&& !qobject_cast<QFocusFrame*>(w)
#if !defined(QT_NO_MENU)
#if QT_CONFIG(menu)
&& !qobject_cast<QMenu*>(w)
#endif
&& w->objectName() != QLatin1String("qt_rubberband")
Expand Down
2 changes: 1 addition & 1 deletion src/widgets/accessible/qaccessiblewidgetfactory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ QAccessibleInterface *qAccessibleFactory(const QString &classname, QObject *obje
} else if (classname == QLatin1String("QMenuBar")) {
iface = new QAccessibleMenuBar(widget);
#endif
#ifndef QT_NO_MENU
#if QT_CONFIG(menu)
} else if (classname == QLatin1String("QMenu")) {
iface = new QAccessibleMenu(widget);
#endif
Expand Down
2 changes: 2 additions & 0 deletions src/widgets/accessible/qaccessiblewidgets.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,9 @@
#include <QMainWindow>
#endif
#include <QFocusFrame>
#if QT_CONFIG(menu)
#include <QMenu>
#endif

#ifndef QT_NO_ACCESSIBILITY

Expand Down
16 changes: 9 additions & 7 deletions src/widgets/accessible/simplewidgets.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,9 @@
#if QT_CONFIG(toolbutton)
#include <qtoolbutton.h>
#endif
#if QT_CONFIG(menu)
#include <qmenu.h>
#endif
#if QT_CONFIG(label)
#include <qlabel.h>
#endif
Expand Down Expand Up @@ -178,7 +180,7 @@ QAccessible::State QAccessibleButton::state() const
if (pb) {
if (pb->isDefault())
state.defaultButton = true;
#ifndef QT_NO_MENU
#if QT_CONFIG(menu)
if (pb->menu())
state.hasPopup = true;
#endif
Expand Down Expand Up @@ -217,7 +219,7 @@ QAccessible::Role QAccessibleButton::role() const
{
QAbstractButton *ab = button();

#ifndef QT_NO_MENU
#if QT_CONFIG(menu)
if (QPushButton *pb = qobject_cast<QPushButton*>(ab)) {
if (pb->menu())
return QAccessible::ButtonMenu;
Expand Down Expand Up @@ -260,7 +262,7 @@ void QAccessibleButton::doAction(const QString &actionName)
return;
if (actionName == pressAction() ||
actionName == showMenuAction()) {
#ifndef QT_NO_MENU
#if QT_CONFIG(menu)
QPushButton *pb = qobject_cast<QPushButton*>(object());
if (pb && pb->menu())
pb->showMenu();
Expand Down Expand Up @@ -314,7 +316,7 @@ QToolButton *QAccessibleToolButton::toolButton() const
*/
bool QAccessibleToolButton::isSplitButton() const
{
#ifndef QT_NO_MENU
#if QT_CONFIG(menu)
return toolButton()->menu() && toolButton()->popupMode() == QToolButton::MenuButtonPopup;
#else
return false;
Expand All @@ -326,7 +328,7 @@ QAccessible::State QAccessibleToolButton::state() const
QAccessible::State st = QAccessibleButton::state();
if (toolButton()->autoRaise())
st.hotTracked = true;
#ifndef QT_NO_MENU
#if QT_CONFIG(menu)
if (toolButton()->menu())
st.hasPopup = true;
#endif
Expand All @@ -340,7 +342,7 @@ int QAccessibleToolButton::childCount() const

QAccessible::Role QAccessibleToolButton::role() const
{
#ifndef QT_NO_MENU
#if QT_CONFIG(menu)
QAbstractButton *ab = button();
QToolButton *tb = qobject_cast<QToolButton*>(ab);
if (!tb->menu())
Expand All @@ -354,7 +356,7 @@ QAccessible::Role QAccessibleToolButton::role() const

QAccessibleInterface *QAccessibleToolButton::child(int index) const
{
#ifndef QT_NO_MENU
#if QT_CONFIG(menu)
if (index == 0 && toolButton()->menu())
{
return QAccessible::queryAccessibleInterface(toolButton()->menu());
Expand Down
4 changes: 3 additions & 1 deletion src/widgets/dialogs/qcolordialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,9 @@
#include "qlabel.h"
#include "qlayout.h"
#include "qlineedit.h"
#if QT_CONFIG(menu)
#include "qmenu.h"
#endif
#include "qpainter.h"
#include "qpixmap.h"
#include "qpushbutton.h"
Expand Down Expand Up @@ -427,7 +429,7 @@ void QWellArray::setSelected(int row, int col)
if (row >= 0)
emit selected(row, col);

#ifndef QT_NO_MENU
#if QT_CONFIG(menu)
if (isVisible() && qobject_cast<QMenu*>(parentWidget()))
parentWidget()->close();
#endif
Expand Down
4 changes: 3 additions & 1 deletion src/widgets/dialogs/qdialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,9 @@
#if QT_CONFIG(whatsthis)
#include "qwhatsthis.h"
#endif
#if QT_CONFIG(menu)
#include "qmenu.h"
#endif
#include "qcursor.h"
#if QT_CONFIG(messagebox)
#include "qmessagebox.h"
Expand Down Expand Up @@ -622,7 +624,7 @@ bool QDialog::eventFilter(QObject *o, QEvent *e)
/*! \reimp */
void QDialog::contextMenuEvent(QContextMenuEvent *e)
{
#if !QT_CONFIG(whatsthis) || defined(QT_NO_MENU)
#if !QT_CONFIG(whatsthis) || !QT_CONFIG(menu)
Q_UNUSED(e);
#else
QWidget *w = childAt(e->pos());
Expand Down
6 changes: 4 additions & 2 deletions src/widgets/dialogs/qfiledialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,9 @@
#include <qheaderview.h>
#include <qshortcut.h>
#include <qgridlayout.h>
#if QT_CONFIG(menu)
#include <qmenu.h>
#endif
#if QT_CONFIG(messagebox)
#include <qmessagebox.h>
#endif
Expand Down Expand Up @@ -3353,7 +3355,7 @@ void QFileDialogPrivate::_q_showDetailsView()
*/
void QFileDialogPrivate::_q_showContextMenu(const QPoint &position)
{
#ifdef QT_NO_MENU
#if !QT_CONFIG(menu)
Q_UNUSED(position);
#else
Q_Q(QFileDialog);
Expand Down Expand Up @@ -3382,7 +3384,7 @@ void QFileDialogPrivate::_q_showContextMenu(const QPoint &position)
menu.addAction(newFolderAction);
}
menu.exec(view->viewport()->mapToGlobal(position));
#endif // QT_NO_MENU
#endif // QT_CONFIG(menu)
}

/*!
Expand Down
2 changes: 2 additions & 0 deletions src/widgets/dialogs/qmessagebox.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,9 @@
#if QT_CONFIG(textedit)
#include <QtWidgets/qtextedit.h>
#endif
#if QT_CONFIG(menu)
#include <QtWidgets/qmenu.h>
#endif
#include "qdialog_p.h"
#include <QtGui/qfont.h>
#include <QtGui/qfontmetrics.h>
Expand Down
6 changes: 4 additions & 2 deletions src/widgets/dialogs/qsidebar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,9 @@

#include <qaction.h>
#include <qurl.h>
#if QT_CONFIG(menu)
#include <qmenu.h>
#endif
#include <qmimedata.h>
#include <qevent.h>
#include <qdebug.h>
Expand Down Expand Up @@ -435,7 +437,7 @@ void QSidebar::selectUrl(const QUrl &url)
this, SLOT(clicked(QModelIndex)));
}

#ifndef QT_NO_MENU
#if QT_CONFIG(menu)
/*!
\internal
Expand All @@ -454,7 +456,7 @@ void QSidebar::showContextMenu(const QPoint &position)
if (actions.count() > 0)
QMenu::exec(actions, mapToGlobal(position));
}
#endif // QT_NO_MENU
#endif // QT_CONFIG(menu)

/*!
\internal
Expand Down
2 changes: 1 addition & 1 deletion src/widgets/dialogs/qsidebar_p.h
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ class Q_AUTOTEST_EXPORT QSidebar : public QListView

private Q_SLOTS:
void clicked(const QModelIndex &index);
#ifndef QT_NO_MENU
#if QT_CONFIG(menu)
void showContextMenu(const QPoint &position);
#endif
void removeEntry();
Expand Down
6 changes: 4 additions & 2 deletions src/widgets/kernel/qaction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,9 @@
#include "qlist.h"
#include <private/qshortcutmap_p.h>
#include <private/qapplication_p.h>
#if QT_CONFIG(menu)
#include <private/qmenu_p.h>
#endif
#include <private/qdebug_p.h>

#define QAPP_CHECK(functionName) \
Expand Down Expand Up @@ -643,7 +645,7 @@ QIcon QAction::icon() const
return d->icon;
}

#ifndef QT_NO_MENU
#if QT_CONFIG(menu)
/*!
Returns the menu contained by this action. Actions that contain
menus can be used to create menu items with submenus, or inserted
Expand All @@ -670,7 +672,7 @@ void QAction::setMenu(QMenu *menu)
menu->d_func()->setOverrideMenuAction(this);
d->sendDataChanged();
}
#endif // QT_NO_MENU
#endif // QT_CONFIG(menu)

/*!
If \a b is true then this action will be considered a separator.
Expand Down
2 changes: 1 addition & 1 deletion src/widgets/kernel/qaction.h
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ class Q_WIDGETS_EXPORT QAction : public QObject
void setPriority(Priority priority);
Priority priority() const;

#ifndef QT_NO_MENU
#if QT_CONFIG(menu)
QMenu *menu() const;
void setMenu(QMenu *menu);
#endif
Expand Down
2 changes: 2 additions & 0 deletions src/widgets/kernel/qaction_p.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,9 @@

#include <QtWidgets/private/qtwidgetsglobal_p.h>
#include "QtWidgets/qaction.h"
#if QT_CONFIG(menu)
#include "QtWidgets/qmenu.h"
#endif
#if QT_CONFIG(graphicsview)
#include "private/qgraphicswidget_p.h"
#endif
Expand Down
4 changes: 3 additions & 1 deletion src/widgets/kernel/qshortcut.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,9 @@
#if QT_CONFIG(whatsthis)
#include <qwhatsthis.h>
#endif
#if QT_CONFIG(menu)
#include <qmenu.h>
#endif
#if QT_CONFIG(menubar)
#include <qmenubar.h>
#endif
Expand Down Expand Up @@ -276,7 +278,7 @@ static bool correctActionContext(Qt::ShortcutContext context, QAction *a, QWidge
#endif
for (int i = 0; i < widgets.size(); ++i) {
QWidget *w = widgets.at(i);
#ifndef QT_NO_MENU
#if QT_CONFIG(menu)
if (QMenu *menu = qobject_cast<QMenu *>(w)) {
#ifdef Q_OS_DARWIN
// On Mac, menu item shortcuts are processed before reaching any window.
Expand Down
4 changes: 3 additions & 1 deletion src/widgets/kernel/qwidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,9 @@
#include "qdesktopwidget_p.h"
#include "qevent.h"
#include "qlayout.h"
#if QT_CONFIG(menu)
#include "qmenu.h"
#endif
#include "qmetaobject.h"
#include "qpixmap.h"
#include "qpointer.h"
Expand Down Expand Up @@ -8996,7 +8998,7 @@ bool QWidget::event(QEvent *event)
case Qt::CustomContextMenu:
emit customContextMenuRequested(static_cast<QContextMenuEvent *>(event)->pos());
break;
#ifndef QT_NO_MENU
#if QT_CONFIG(menu)
case Qt::ActionsContextMenu:
if (d->actions.count()) {
QMenu::exec(d->actions, static_cast<QContextMenuEvent *>(event)->globalPos(),
Expand Down
Loading

0 comments on commit 6d699d0

Please sign in to comment.