summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--examples/widgets/mainwindows/mainwindow/colorswatch.cpp2
-rw-r--r--examples/widgets/mainwindows/mainwindow/colorswatch.h2
-rw-r--r--examples/widgets/mainwindows/menus/mainwindow.cpp2
-rw-r--r--examples/widgets/mainwindows/menus/mainwindow.h2
-rw-r--r--src/gui/kernel/qevent.cpp2
-rw-r--r--src/plugins/platforminputcontexts/ibus/qibusplatforminputcontext.cpp2
-rw-r--r--src/plugins/platforms/xcb/qxcbkeyboard.cpp2
-rw-r--r--src/widgets/dialogs/qmessagebox.cpp6
-rw-r--r--src/widgets/kernel/qwidgetwindow.cpp8
-rw-r--r--src/widgets/util/qsystemtrayicon_x11.cpp4
-rw-r--r--src/widgets/widgets/qcombobox.h2
-rw-r--r--src/widgets/widgets/qlabel.cpp6
-rw-r--r--src/widgets/widgets/qlabel.h2
-rw-r--r--src/widgets/widgets/qtextedit.cpp2
-rw-r--r--tests/auto/widgets/graphicsview/qgraphicsitem/tst_qgraphicsitem.cpp8
-rw-r--r--tests/auto/widgets/graphicsview/qgraphicsproxywidget/tst_qgraphicsproxywidget.cpp7
-rw-r--r--tests/auto/widgets/graphicsview/qgraphicsscene/tst_qgraphicsscene.cpp4
-rw-r--r--tests/auto/widgets/graphicsview/qgraphicsview/tst_qgraphicsview.cpp4
-rw-r--r--tests/auto/widgets/styles/qstylesheetstyle/tst_qstylesheetstyle.cpp2
-rw-r--r--tests/auto/widgets/widgets/qlineedit/tst_qlineedit.cpp2
20 files changed, 59 insertions, 12 deletions
diff --git a/examples/widgets/mainwindows/mainwindow/colorswatch.cpp b/examples/widgets/mainwindows/mainwindow/colorswatch.cpp
index d746bbe8d3..cd0543ecd9 100644
--- a/examples/widgets/mainwindows/mainwindow/colorswatch.cpp
+++ b/examples/widgets/mainwindows/mainwindow/colorswatch.cpp
@@ -468,11 +468,13 @@ void ColorSwatch::tabInto(QAction *action)
mainWindow->tabifyDockWidget(target, this);
}
+#ifndef QT_NO_CONTEXTMENU
void ColorSwatch::contextMenuEvent(QContextMenuEvent *event)
{
event->accept();
menu->exec(event->globalPos());
}
+#endif // QT_NO_CONTEXTMENU
void ColorSwatch::resizeEvent(QResizeEvent *e)
{
diff --git a/examples/widgets/mainwindows/mainwindow/colorswatch.h b/examples/widgets/mainwindows/mainwindow/colorswatch.h
index 8827a7dca7..251807d60f 100644
--- a/examples/widgets/mainwindows/mainwindow/colorswatch.h
+++ b/examples/widgets/mainwindows/mainwindow/colorswatch.h
@@ -51,7 +51,9 @@ public:
QMenu *colorSwatchMenu() const { return menu; }
protected:
+#ifndef QT_NO_CONTEXTMENU
void contextMenuEvent(QContextMenuEvent *event) Q_DECL_OVERRIDE;
+#endif // QT_NO_CONTEXTMENU
void resizeEvent(QResizeEvent *e) Q_DECL_OVERRIDE;
private slots:
diff --git a/examples/widgets/mainwindows/menus/mainwindow.cpp b/examples/widgets/mainwindows/menus/mainwindow.cpp
index d487e3a277..fb06bc8ad0 100644
--- a/examples/widgets/mainwindows/menus/mainwindow.cpp
+++ b/examples/widgets/mainwindows/menus/mainwindow.cpp
@@ -83,6 +83,7 @@ MainWindow::MainWindow()
//! [2]
//! [3]
+#ifndef QT_NO_CONTEXTMENU
void MainWindow::contextMenuEvent(QContextMenuEvent *event)
{
QMenu menu(this);
@@ -91,6 +92,7 @@ void MainWindow::contextMenuEvent(QContextMenuEvent *event)
menu.addAction(pasteAct);
menu.exec(event->globalPos());
}
+#endif // QT_NO_CONTEXTMENU
//! [3]
void MainWindow::newFile()
diff --git a/examples/widgets/mainwindows/menus/mainwindow.h b/examples/widgets/mainwindows/menus/mainwindow.h
index 9710580819..57dd036767 100644
--- a/examples/widgets/mainwindows/menus/mainwindow.h
+++ b/examples/widgets/mainwindows/menus/mainwindow.h
@@ -59,7 +59,9 @@ public:
MainWindow();
protected:
+#ifndef QT_NO_CONTEXTMENU
void contextMenuEvent(QContextMenuEvent *event) Q_DECL_OVERRIDE;
+#endif // QT_NO_CONTEXTMENU
//! [0]
//! [1]
diff --git a/src/gui/kernel/qevent.cpp b/src/gui/kernel/qevent.cpp
index 3873976144..c7df6107f7 100644
--- a/src/gui/kernel/qevent.cpp
+++ b/src/gui/kernel/qevent.cpp
@@ -3940,9 +3940,11 @@ QDebug operator<<(QDebug dbg, const QEvent *e)
QtDebugUtils::formatQEnum(dbg, static_cast<const QApplicationStateChangeEvent *>(e)->applicationState());
dbg << ')';
break;
+# ifndef QT_NO_CONTEXTMENU
case QEvent::ContextMenu:
dbg << "QContextMenuEvent(" << static_cast<const QContextMenuEvent *>(e)->pos() << ')';
break;
+# endif // !QT_NO_CONTEXTMENU
# ifndef QT_NO_TABLETEVENT
case QEvent::TabletEnterProximity:
case QEvent::TabletLeaveProximity:
diff --git a/src/plugins/platforminputcontexts/ibus/qibusplatforminputcontext.cpp b/src/plugins/platforminputcontexts/ibus/qibusplatforminputcontext.cpp
index 4a276dc834..2027e010d0 100644
--- a/src/plugins/platforminputcontexts/ibus/qibusplatforminputcontext.cpp
+++ b/src/plugins/platforminputcontexts/ibus/qibusplatforminputcontext.cpp
@@ -366,6 +366,7 @@ void QIBusPlatformInputContext::filterEventFinished(QDBusPendingCallWatcher *cal
bool retval = reply.value();
qCDebug(qtQpaInputMethods) << "filterEventFinished return" << code << sym << state << retval;
if (!retval) {
+#ifndef QT_NO_CONTEXTMENU
QWindow *window = dynamic_cast<QWindow *>(input);
if (type == QEvent::KeyPress && qtcode == Qt::Key_Menu
&& window != NULL) {
@@ -374,6 +375,7 @@ void QIBusPlatformInputContext::filterEventFinished(QDBusPendingCallWatcher *cal
QWindowSystemInterface::handleContextMenuEvent(window, false, pos,
globalPos, modifiers);
}
+#endif // QT_NO_CONTEXTMENU
QKeyEvent event(type, qtcode, modifiers, code, sym,
state, string, isAutoRepeat, count);
event.setTimestamp(time);
diff --git a/src/plugins/platforms/xcb/qxcbkeyboard.cpp b/src/plugins/platforms/xcb/qxcbkeyboard.cpp
index 2e088d3ca5..0bfefc962e 100644
--- a/src/plugins/platforms/xcb/qxcbkeyboard.cpp
+++ b/src/plugins/platforms/xcb/qxcbkeyboard.cpp
@@ -1511,11 +1511,13 @@ void QXcbKeyboard::handleKeyEvent(xcb_window_t sourceWindow, QEvent::Type type,
QWindow *window = targetWindow->window();
if (!filtered) {
+#ifndef QT_NO_CONTEXTMENU
if (type == QEvent::KeyPress && qtcode == Qt::Key_Menu) {
const QPoint globalPos = window->screen()->handle()->cursor()->pos();
const QPoint pos = window->mapFromGlobal(globalPos);
QWindowSystemInterface::handleContextMenuEvent(window, false, pos, globalPos, modifiers);
}
+#endif // QT_NO_CONTEXTMENU
QWindowSystemInterface::handleExtendedKeyEvent(window, time, type, qtcode, modifiers,
code, sym, state, string, isAutoRepeat);
}
diff --git a/src/widgets/dialogs/qmessagebox.cpp b/src/widgets/dialogs/qmessagebox.cpp
index ef9b55acd6..66e506bd80 100644
--- a/src/widgets/dialogs/qmessagebox.cpp
+++ b/src/widgets/dialogs/qmessagebox.cpp
@@ -89,16 +89,14 @@ public:
{
public:
TextEdit(QWidget *parent=0) : QTextEdit(parent) { }
+#ifndef QT_NO_CONTEXTMENU
void contextMenuEvent(QContextMenuEvent * e) Q_DECL_OVERRIDE
{
-#ifndef QT_NO_CONTEXTMENU
QMenu *menu = createStandardContextMenu();
menu->setAttribute(Qt::WA_DeleteOnClose);
menu->popup(e->globalPos());
-#else
- Q_UNUSED(e);
-#endif
}
+#endif // QT_NO_CONTEXTMENU
};
QMessageBoxDetailsText(QWidget *parent=0)
diff --git a/src/widgets/kernel/qwidgetwindow.cpp b/src/widgets/kernel/qwidgetwindow.cpp
index 58436a7d92..f1e25d116d 100644
--- a/src/widgets/kernel/qwidgetwindow.cpp
+++ b/src/widgets/kernel/qwidgetwindow.cpp
@@ -283,7 +283,7 @@ bool QWidgetWindow::event(QEvent *event)
case QEvent::ContextMenu:
handleContextMenuEvent(static_cast<QContextMenuEvent *>(event));
return true;
-#endif
+#endif // QT_NO_CONTEXTMENU
// Handing show events to widgets (see below) here would cause them to be triggered twice
case QEvent::Show:
@@ -510,8 +510,12 @@ void QWidgetWindow::handleMouseEvent(QMouseEvent *event)
popupEvent = popupChild;
QContextMenuEvent e(QContextMenuEvent::Mouse, mapped, event->globalPos(), event->modifiers());
QApplication::sendSpontaneousEvent(popupEvent, &e);
-#endif
}
+#else
+ Q_UNUSED(contextMenuTrigger)
+ Q_UNUSED(oldOpenPopupCount)
+ }
+#endif
if (releaseAfter) {
qt_button_down = 0;
diff --git a/src/widgets/util/qsystemtrayicon_x11.cpp b/src/widgets/util/qsystemtrayicon_x11.cpp
index 9a69db1bc8..e50b0bd12c 100644
--- a/src/widgets/util/qsystemtrayicon_x11.cpp
+++ b/src/widgets/util/qsystemtrayicon_x11.cpp
@@ -170,7 +170,9 @@ void QSystemTrayIconSys::mousePressEvent(QMouseEvent *ev)
#ifndef QT_NO_CONTEXTMENU
if (ev->button() == Qt::RightButton && q->contextMenu())
q->contextMenu()->popup(globalPos);
-#endif
+#else
+ Q_UNUSED(globalPos)
+#endif // QT_NO_CONTEXTMENU
if (QBalloonTip::isBalloonVisible()) {
emit q->messageClicked();
diff --git a/src/widgets/widgets/qcombobox.h b/src/widgets/widgets/qcombobox.h
index 3182a0a3aa..45b601788f 100644
--- a/src/widgets/widgets/qcombobox.h
+++ b/src/widgets/widgets/qcombobox.h
@@ -229,7 +229,9 @@ protected:
#ifndef QT_NO_WHEELEVENT
void wheelEvent(QWheelEvent *e) Q_DECL_OVERRIDE;
#endif
+#ifndef QT_NO_CONTEXTMENU
void contextMenuEvent(QContextMenuEvent *e) Q_DECL_OVERRIDE;
+#endif // QT_NO_CONTEXTMENU
void inputMethodEvent(QInputMethodEvent *) Q_DECL_OVERRIDE;
void initStyleOption(QStyleOptionComboBox *option) const;
diff --git a/src/widgets/widgets/qlabel.cpp b/src/widgets/widgets/qlabel.cpp
index 55e277026c..eeabd5db38 100644
--- a/src/widgets/widgets/qlabel.cpp
+++ b/src/widgets/widgets/qlabel.cpp
@@ -882,13 +882,11 @@ void QLabel::mouseReleaseEvent(QMouseEvent *ev)
d->sendControlEvent(ev);
}
+#ifndef QT_NO_CONTEXTMENU
/*!\reimp
*/
void QLabel::contextMenuEvent(QContextMenuEvent *ev)
{
-#ifdef QT_NO_CONTEXTMENU
- Q_UNUSED(ev);
-#else
Q_D(QLabel);
if (!d->isTextLabel) {
ev->ignore();
@@ -902,8 +900,8 @@ void QLabel::contextMenuEvent(QContextMenuEvent *ev)
ev->accept();
menu->setAttribute(Qt::WA_DeleteOnClose);
menu->popup(ev->globalPos());
-#endif
}
+#endif // QT_NO_CONTEXTMENU
/*!
\reimp
diff --git a/src/widgets/widgets/qlabel.h b/src/widgets/widgets/qlabel.h
index 1a3a68db60..6b6e15e0a8 100644
--- a/src/widgets/widgets/qlabel.h
+++ b/src/widgets/widgets/qlabel.h
@@ -132,7 +132,9 @@ protected:
void mousePressEvent(QMouseEvent *ev) Q_DECL_OVERRIDE;
void mouseMoveEvent(QMouseEvent *ev) Q_DECL_OVERRIDE;
void mouseReleaseEvent(QMouseEvent *ev) Q_DECL_OVERRIDE;
+#ifndef QT_NO_CONTEXTMENU
void contextMenuEvent(QContextMenuEvent *ev) Q_DECL_OVERRIDE;
+#endif // QT_NO_CONTEXTMENU
void focusInEvent(QFocusEvent *ev) Q_DECL_OVERRIDE;
void focusOutEvent(QFocusEvent *ev) Q_DECL_OVERRIDE;
bool focusNextPrevChild(bool next) Q_DECL_OVERRIDE;
diff --git a/src/widgets/widgets/qtextedit.cpp b/src/widgets/widgets/qtextedit.cpp
index 7439005b92..ba6db2971a 100644
--- a/src/widgets/widgets/qtextedit.cpp
+++ b/src/widgets/widgets/qtextedit.cpp
@@ -1060,6 +1060,8 @@ bool QTextEdit::event(QEvent *e)
|| e->type() == QEvent::ToolTip) {
d->sendControlEvent(e);
}
+#else
+ Q_UNUSED(d)
#endif // QT_NO_CONTEXTMENU
#ifdef QT_KEYPAD_NAVIGATION
if (e->type() == QEvent::EnterEditFocus || e->type() == QEvent::LeaveEditFocus) {
diff --git a/tests/auto/widgets/graphicsview/qgraphicsitem/tst_qgraphicsitem.cpp b/tests/auto/widgets/graphicsview/qgraphicsitem/tst_qgraphicsitem.cpp
index 2ea51bb2dd..c097a6a969 100644
--- a/tests/auto/widgets/graphicsview/qgraphicsitem/tst_qgraphicsitem.cpp
+++ b/tests/auto/widgets/graphicsview/qgraphicsitem/tst_qgraphicsitem.cpp
@@ -385,7 +385,9 @@ private slots:
void itemContainsChildrenInShape2();
void ancestorFlags();
void untransformable();
+#ifndef QT_NO_CONTEXTMENU
void contextMenuEventPropagation();
+#endif // QT_NO_CONTEXTMENU
void itemIsMovable();
void boundingRegion_data();
void boundingRegion();
@@ -5193,6 +5195,7 @@ public:
}
protected:
+#ifndef QT_NO_CONTEXTMENU
void contextMenuEvent(QGraphicsSceneContextMenuEvent *)
{
if (harakiri == 3) {
@@ -5200,6 +5203,7 @@ protected:
delete this;
}
}
+#endif // QT_NO_CONTEXTMENU
void dragEnterEvent(QGraphicsSceneDragDropEvent *event)
{
@@ -5378,11 +5382,13 @@ void tst_QGraphicsItem::deleteItemInEventHandlers()
if (!item->dead)
scene.advance();
+#ifndef QT_NO_CONTEXTMENU
if (!item->dead) {
QContextMenuEvent event(QContextMenuEvent::Other,
view.mapFromScene(item->scenePos()));
QCoreApplication::sendEvent(view.viewport(), &event);
}
+#endif // QT_NO_CONTEXTMENU
if (!item->dead)
QTest::mouseMove(view.viewport(), view.mapFromScene(item->scenePos()));
if (!item->dead)
@@ -6276,6 +6282,7 @@ void tst_QGraphicsItem::untransformable()
}
}
+#ifndef QT_NO_CONTEXTMENU
class ContextMenuItem : public QGraphicsRectItem
{
public:
@@ -6339,6 +6346,7 @@ void tst_QGraphicsItem::contextMenuEventPropagation()
QCOMPARE(bottomItem->gotEvent, false);
QCOMPARE(topItem->eventWasAccepted, true);
}
+#endif // QT_NO_CONTEXTMENU
void tst_QGraphicsItem::itemIsMovable()
{
diff --git a/tests/auto/widgets/graphicsview/qgraphicsproxywidget/tst_qgraphicsproxywidget.cpp b/tests/auto/widgets/graphicsview/qgraphicsproxywidget/tst_qgraphicsproxywidget.cpp
index bbd508ce79..27b90db2e6 100644
--- a/tests/auto/widgets/graphicsview/qgraphicsproxywidget/tst_qgraphicsproxywidget.cpp
+++ b/tests/auto/widgets/graphicsview/qgraphicsproxywidget/tst_qgraphicsproxywidget.cpp
@@ -162,7 +162,9 @@ private slots:
void fontPropagation();
void dontCrashWhenDie();
void createProxyForChildWidget();
+#ifndef QT_NO_CONTEXTMENU
void actionsContextMenu();
+#endif // QT_NO_CONTEXTMENU
void actionsContextMenu_data();
void deleteProxyForChildWidget();
void bypassGraphicsProxyWidget_data();
@@ -3071,6 +3073,7 @@ void tst_QGraphicsProxyWidget::createProxyForChildWidget()
delete boxProxy;
}
+#ifndef QT_NO_CONTEXTMENU
class ContextMenuWidget : public QLabel
{
Q_OBJECT
@@ -3119,6 +3122,7 @@ private:
bool m_embeddedPopupSet;
QTimer *m_timer;
};
+#endif // QT_NO_CONTEXTMENU
void tst_QGraphicsProxyWidget::actionsContextMenu_data()
{
@@ -3131,6 +3135,7 @@ void tst_QGraphicsProxyWidget::actionsContextMenu_data()
QTest::newRow("with actionsContextMenu without focus") << true << false;
}
+#ifndef QT_NO_CONTEXTMENU
void tst_QGraphicsProxyWidget::actionsContextMenu()
{
QFETCH(bool, hasFocus);
@@ -3185,7 +3190,7 @@ void tst_QGraphicsProxyWidget::actionsContextMenu()
}
}
-
+#endif // QT_NO_CONTEXTMENU
void tst_QGraphicsProxyWidget::deleteProxyForChildWidget()
{
diff --git a/tests/auto/widgets/graphicsview/qgraphicsscene/tst_qgraphicsscene.cpp b/tests/auto/widgets/graphicsview/qgraphicsscene/tst_qgraphicsscene.cpp
index 2888e94220..4a16c8583d 100644
--- a/tests/auto/widgets/graphicsview/qgraphicsscene/tst_qgraphicsscene.cpp
+++ b/tests/auto/widgets/graphicsview/qgraphicsscene/tst_qgraphicsscene.cpp
@@ -227,8 +227,10 @@ private slots:
void render_data();
void render();
void renderItemsWithNegativeWidthOrHeight();
+#ifndef QT_NO_CONTEXTMENU
void contextMenuEvent();
void contextMenuEvent_ItemIgnoresTransformations();
+#endif
void update();
void update2();
void views();
@@ -2712,6 +2714,7 @@ void tst_QGraphicsScene::renderItemsWithNegativeWidthOrHeight()
QCOMPARE(actual, expected);
}
+#ifndef QT_NO_CONTEXTMENU
void tst_QGraphicsScene::contextMenuEvent()
{
QGraphicsScene scene;
@@ -2794,6 +2797,7 @@ void tst_QGraphicsScene::contextMenuEvent_ItemIgnoresTransformations()
QVERIFY(!event.isAccepted());
}
}
+#endif // QT_NO_CONTEXTMENU
void tst_QGraphicsScene::update()
{
diff --git a/tests/auto/widgets/graphicsview/qgraphicsview/tst_qgraphicsview.cpp b/tests/auto/widgets/graphicsview/qgraphicsview/tst_qgraphicsview.cpp
index 85ddc7f710..087a19c6dd 100644
--- a/tests/auto/widgets/graphicsview/qgraphicsview/tst_qgraphicsview.cpp
+++ b/tests/auto/widgets/graphicsview/qgraphicsview/tst_qgraphicsview.cpp
@@ -469,10 +469,12 @@ void tst_QGraphicsView::interactive()
QCOMPARE(item->events.size(), i * 5 + 5);
QCOMPARE(item->events.at(item->events.size() - 2), QEvent::GraphicsSceneMouseRelease);
QCOMPARE(item->events.at(item->events.size() - 1), QEvent::UngrabMouse);
+#ifndef QT_NO_CONTEXTMENU
QContextMenuEvent contextEvent(QContextMenuEvent::Mouse, itemPoint, view.mapToGlobal(itemPoint));
QApplication::sendEvent(view.viewport(), &contextEvent);
QCOMPARE(item->events.size(), i * 5 + 6);
QCOMPARE(item->events.last(), QEvent::GraphicsSceneContextMenu);
+#endif // QT_NO_CONTEXTMENU
}
view.setInteractive(false);
@@ -484,10 +486,12 @@ void tst_QGraphicsView::interactive()
sendMouseRelease(view.viewport(), itemPoint);
QCOMPARE(item->events.size(), 501);
QCOMPARE(item->events.last(), QEvent::GraphicsSceneContextMenu);
+#ifndef QT_NO_CONTEXTMENU
QContextMenuEvent contextEvent(QContextMenuEvent::Mouse, itemPoint, view.mapToGlobal(itemPoint));
QApplication::sendEvent(view.viewport(), &contextEvent);
QCOMPARE(item->events.size(), 501);
QCOMPARE(item->events.last(), QEvent::GraphicsSceneContextMenu);
+#endif // QT_NO_CONTEXTMENU
}
}
diff --git a/tests/auto/widgets/styles/qstylesheetstyle/tst_qstylesheetstyle.cpp b/tests/auto/widgets/styles/qstylesheetstyle/tst_qstylesheetstyle.cpp
index a511e91e2c..5b0ae29dc1 100644
--- a/tests/auto/widgets/styles/qstylesheetstyle/tst_qstylesheetstyle.cpp
+++ b/tests/auto/widgets/styles/qstylesheetstyle/tst_qstylesheetstyle.cpp
@@ -1471,12 +1471,14 @@ void tst_QStyleSheetStyle::embeddedFonts()
QCOMPARE(spin.font().pixelSize(), 32);
QCOMPARE(embedded->font().pixelSize(), 32);
+#ifndef QT_NO_CONTEXTMENU
QMenu *menu = embedded->createStandardContextMenu();
menu->show();
QTest::qWait(20);
QVERIFY(menu);
QVERIFY(menu->font().pixelSize() != 32);
QCOMPARE(menu->font().pixelSize(), qApp->font(menu).pixelSize());
+#endif // QT_NO_CONTEXTMENU
//task 242556
QComboBox box;
diff --git a/tests/auto/widgets/widgets/qlineedit/tst_qlineedit.cpp b/tests/auto/widgets/widgets/qlineedit/tst_qlineedit.cpp
index 5c8f6eeeb8..802c6c3e2c 100644
--- a/tests/auto/widgets/widgets/qlineedit/tst_qlineedit.cpp
+++ b/tests/auto/widgets/widgets/qlineedit/tst_qlineedit.cpp
@@ -2243,6 +2243,7 @@ void tst_QLineEdit::deleteSelectedText()
edit.setText(text);
edit.selectAll();
+#ifndef QT_NO_CONTEXTMENU
QMenu *menu = edit.createStandardContextMenu();
for (int i = 0; i < menu->actions().count(); ++i) {
QAction *current = menu->actions().at(i);
@@ -2251,6 +2252,7 @@ void tst_QLineEdit::deleteSelectedText()
QVERIFY(edit.text().isEmpty());
}
}
+#endif // QT_NO_CONTEXTMENU
}