summaryrefslogtreecommitdiffstats
path: root/tests/manual/cocoa
diff options
context:
space:
mode:
Diffstat (limited to 'tests/manual/cocoa')
-rw-r--r--tests/manual/cocoa/menurama/mainwindow.cpp8
-rw-r--r--tests/manual/cocoa/menurama/mainwindow.ui98
-rw-r--r--tests/manual/cocoa/menurama/menuramaapplication.cpp16
-rw-r--r--tests/manual/cocoa/menurama/menuramaapplication.h1
-rw-r--r--tests/manual/cocoa/qmaccocoaviewcontainer/main.mm1
5 files changed, 73 insertions, 51 deletions
diff --git a/tests/manual/cocoa/menurama/mainwindow.cpp b/tests/manual/cocoa/menurama/mainwindow.cpp
index db8fdafc21..f7762f57f5 100644
--- a/tests/manual/cocoa/menurama/mainwindow.cpp
+++ b/tests/manual/cocoa/menurama/mainwindow.cpp
@@ -56,7 +56,13 @@ MainWindow::MainWindow(QWidget *parent) :
});
connect(ui->menuDynamic_Stuff, &QMenu::aboutToShow, [=] {
- menuApp->addDynMenu(QLatin1String("Added After aboutToShow()"), ui->menuDynamic_Stuff);
+ menuApp->addDynMenu(QLatin1String("Menu Added After aboutToShow()"), ui->menuDynamic_Stuff);
+
+ const QLatin1String itemTitle = QLatin1String("Disabled Item Added After aboutToShow()");
+ if (QAction *a = menuApp->findAction(itemTitle, ui->menuDynamic_Stuff))
+ ui->menuDynamic_Stuff->removeAction(a);
+ QAction *a = ui->menuDynamic_Stuff->addAction(itemTitle);
+ a->setEnabled(false);
});
connect(ui->pushButton, &QPushButton::clicked, [=] {
diff --git a/tests/manual/cocoa/menurama/mainwindow.ui b/tests/manual/cocoa/menurama/mainwindow.ui
index f73b41b861..d3caa6c608 100644
--- a/tests/manual/cocoa/menurama/mainwindow.ui
+++ b/tests/manual/cocoa/menurama/mainwindow.ui
@@ -6,63 +6,71 @@
<rect>
<x>0</x>
<y>0</y>
- <width>566</width>
- <height>300</height>
+ <width>429</width>
+ <height>251</height>
</rect>
</property>
<property name="windowTitle">
<string>MainWindow</string>
</property>
<widget class="QWidget" name="centralWidget">
- <widget class="QCheckBox" name="checkBox">
- <property name="geometry">
- <rect>
- <x>10</x>
- <y>40</y>
- <width>151</width>
- <height>20</height>
- </rect>
- </property>
- <property name="text">
- <string>Enable &quot;Stuff&quot; Menu</string>
- </property>
- <property name="checked">
- <bool>true</bool>
- </property>
- </widget>
- <widget class="QLabel" name="label">
- <property name="geometry">
- <rect>
- <x>10</x>
- <y>10</y>
- <width>321</width>
- <height>16</height>
- </rect>
- </property>
- <property name="text">
- <string>The &quot;Help&quot; menu should NOT be visible.</string>
- </property>
- </widget>
- <widget class="QPushButton" name="pushButton">
- <property name="geometry">
- <rect>
- <x>10</x>
- <y>80</y>
- <width>211</width>
- <height>32</height>
- </rect>
- </property>
- <property name="text">
- <string>Populate Dynamic Submenu</string>
- </property>
- </widget>
+ <layout class="QVBoxLayout" name="verticalLayout_2">
+ <item>
+ <layout class="QVBoxLayout" name="verticalLayout">
+ <property name="spacing">
+ <number>24</number>
+ </property>
+ <item>
+ <widget class="QLabel" name="label">
+ <property name="text">
+ <string>The &quot;Help&quot; menu should NOT be visible.
+
+Click on &quot;Dynamic Stuff&quot; then move left and right to other menus. Disabled items should remain that way.</string>
+ </property>
+ <property name="scaledContents">
+ <bool>false</bool>
+ </property>
+ <property name="alignment">
+ <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
+ </property>
+ <property name="wordWrap">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QCheckBox" name="checkBox">
+ <property name="text">
+ <string>Enable &quot;Stuff&quot; Menu</string>
+ </property>
+ <property name="checked">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QPushButton" name="pushButton">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Maximum" vsizetype="Fixed">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>Populate Dynamic Submenu</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ </layout>
</widget>
<widget class="QMenuBar" name="menuBar">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
- <width>566</width>
+ <width>429</width>
<height>22</height>
</rect>
</property>
diff --git a/tests/manual/cocoa/menurama/menuramaapplication.cpp b/tests/manual/cocoa/menurama/menuramaapplication.cpp
index 534d5fa371..13e457d7dd 100644
--- a/tests/manual/cocoa/menurama/menuramaapplication.cpp
+++ b/tests/manual/cocoa/menurama/menuramaapplication.cpp
@@ -69,13 +69,19 @@ void MenuramaApplication::populateMenu(QMenu *menu, bool clear)
void MenuramaApplication::addDynMenu(QLatin1String title, QMenu *parentMenu)
{
- foreach (QAction *a, parentMenu->actions())
- if (a->text() == title) {
- parentMenu->removeAction(a);
- break;
- }
+ if (QAction *a = findAction(title, parentMenu))
+ parentMenu->removeAction(a);
QMenu *subMenu = new QMenu(title, parentMenu);
populateMenu(subMenu, false /*clear*/);
parentMenu->addMenu(subMenu);
}
+
+QAction *MenuramaApplication::findAction(QLatin1String title, QMenu *parentMenu)
+{
+ foreach (QAction *a, parentMenu->actions())
+ if (a->text() == title)
+ return a;
+
+ return Q_NULLPTR;
+}
diff --git a/tests/manual/cocoa/menurama/menuramaapplication.h b/tests/manual/cocoa/menurama/menuramaapplication.h
index 07c8da27a1..b0670cc53b 100644
--- a/tests/manual/cocoa/menurama/menuramaapplication.h
+++ b/tests/manual/cocoa/menurama/menuramaapplication.h
@@ -50,6 +50,7 @@ class MenuramaApplication : public QApplication
public:
MenuramaApplication(int argc, char **argv);
void addDynMenu(QLatin1String title, QMenu *parentMenu);
+ QAction *findAction(QLatin1String title, QMenu *parentMenu);
public slots:
void populateMenu(QMenu *menu, bool clear);
diff --git a/tests/manual/cocoa/qmaccocoaviewcontainer/main.mm b/tests/manual/cocoa/qmaccocoaviewcontainer/main.mm
index d06c333c9c..9cf06391ca 100644
--- a/tests/manual/cocoa/qmaccocoaviewcontainer/main.mm
+++ b/tests/manual/cocoa/qmaccocoaviewcontainer/main.mm
@@ -80,6 +80,7 @@ int main(int argc, char **argv)
QPoint pos(100,100);
QWidget w;
w.move(pos);
+ w.resize(300, 300);
w.setWindowTitle("QMacCocoaViewContainer");
NSRect r = NSMakeRect(0, 0, 100, 100);
NSView *view = [[TestMouseMovedNSView alloc] initWithFrame: r];