summaryrefslogtreecommitdiffstats
path: root/tests/manual
diff options
context:
space:
mode:
Diffstat (limited to 'tests/manual')
-rw-r--r--tests/manual/cocoa/menurama/main.cpp37
-rw-r--r--tests/manual/cocoa/menurama/mainwindow.ui16
2 files changed, 50 insertions, 3 deletions
diff --git a/tests/manual/cocoa/menurama/main.cpp b/tests/manual/cocoa/menurama/main.cpp
index 00594b6d1f..e39c01ea4d 100644
--- a/tests/manual/cocoa/menurama/main.cpp
+++ b/tests/manual/cocoa/menurama/main.cpp
@@ -29,9 +29,46 @@
#include "mainwindow.h"
#include "menuramaapplication.h"
+#include <QtWidgets/QAction>
+#include <QtWidgets/QMenu>
+
int main(int argc, char *argv[])
{
MenuramaApplication a(argc, argv);
+ a.setQuitOnLastWindowClosed(false);
+
+ auto *dockMenu = new QMenu();
+ dockMenu->setAsDockMenu();
+ dockMenu->addAction(QLatin1String("New Window"), [=] {
+ auto *w = new MainWindow;
+ w->setAttribute(Qt::WA_DeleteOnClose, true);
+ w->show();
+ });
+ auto *disabledAction = dockMenu->addAction(QLatin1String("Disabled Item"), [=] {
+ qDebug() << "Should not happen!";
+ Q_UNREACHABLE();
+ });
+ disabledAction->setEnabled(false);
+ dockMenu->addAction(QLatin1String("Last Item Before Separator"), [=] {
+ qDebug() << "Last Item triggered";
+ });
+ auto *hiddenAction = dockMenu->addAction(QLatin1String("Invisible Item (FIXME rdar:39615815)"), [=] {
+ qDebug() << "Should not happen!";
+ Q_UNREACHABLE();
+ });
+ hiddenAction->setVisible(false);
+ dockMenu->addSeparator();
+ auto *toolsMenu = dockMenu->addMenu(QLatin1String("Menurama Tools"));
+ toolsMenu->addAction(QLatin1String("Hammer"), [=] {
+ qDebug() << "Bang! Bang!";
+ });
+ toolsMenu->addAction(QLatin1String("Wrench"), [=] {
+ qDebug() << "Clang! Clang!";
+ });
+ toolsMenu->addAction(QLatin1String("Screwdriver"), [=] {
+ qDebug() << "Squeak! Squeak!";
+ });
+
MainWindow w;
w.show();
diff --git a/tests/manual/cocoa/menurama/mainwindow.ui b/tests/manual/cocoa/menurama/mainwindow.ui
index 4fb3e3420e..2c6ac52f58 100644
--- a/tests/manual/cocoa/menurama/mainwindow.ui
+++ b/tests/manual/cocoa/menurama/mainwindow.ui
@@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>486</width>
- <height>288</height>
+ <height>376</height>
</rect>
</property>
<property name="windowTitle">
@@ -58,7 +58,7 @@ Click on &quot;Dynamic Stuff&quot; then move left and right to other menus. Disa
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
- <item>
+ <item alignment="Qt::AlignTop">
<widget class="QPushButton" name="addManyButton">
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Fixed">
@@ -71,7 +71,7 @@ Click on &quot;Dynamic Stuff&quot; then move left and right to other menus. Disa
</property>
</widget>
</item>
- <item>
+ <item alignment="Qt::AlignTop">
<widget class="QLabel" name="label_2">
<property name="text">
<string>Adding hundreds of items should not block the UI for noticeable periods of time. Odd numbered items should be disabled, those with 2nd LSB on should be hidden.</string>
@@ -83,6 +83,16 @@ Click on &quot;Dynamic Stuff&quot; then move left and right to other menus. Disa
</item>
</layout>
</item>
+ <item alignment="Qt::AlignTop">
+ <widget class="QLabel" name="label_3">
+ <property name="text">
+ <string>Check out the dock menu. You can close this window to verify that its actions will trigger in the absence of any window. And you can add more windows from there too.</string>
+ </property>
+ <property name="wordWrap">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
</layout>
</widget>
<widget class="QMenuBar" name="menuBar">