summaryrefslogtreecommitdiffstats
path: root/examples/widgets/mainwindows
diff options
context:
space:
mode:
Diffstat (limited to 'examples/widgets/mainwindows')
-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
4 files changed, 8 insertions, 0 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]