diff options
author | Markku Luukkainen <markku.luukkainen@digia.com> | 2009-05-18 09:00:52 (GMT) |
---|---|---|
committer | Markku Luukkainen <markku.luukkainen@digia.com> | 2009-05-18 09:00:52 (GMT) |
commit | 1e2b8d3d63c05bc81f2024959480235489a479a7 (patch) | |
tree | aea1a8073494c977cef586045750ad63392970ab /src | |
parent | 620cfd6a8d4fc84f5626b7eac3b70882620d5ef1 (diff) | |
download | Qt-1e2b8d3d63c05bc81f2024959480235489a479a7.zip Qt-1e2b8d3d63c05bc81f2024959480235489a479a7.tar.gz Qt-1e2b8d3d63c05bc81f2024959480235489a479a7.tar.bz2 |
Added test case for submenus inside context sensitive menu
Diffstat (limited to 'src')
-rw-r--r-- | src/gui/softkeys/main.cpp | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/src/gui/softkeys/main.cpp b/src/gui/softkeys/main.cpp index b0d5ae1..e89c737 100644 --- a/src/gui/softkeys/main.cpp +++ b/src/gui/softkeys/main.cpp @@ -17,6 +17,7 @@ class MainWindow : public QMainWindow public: MainWindow(QWidget *parent = 0); ~MainWindow(); + QMenu *contextMenu; QAction* context1; QAction* context2; QAction* context3; @@ -29,24 +30,30 @@ public: MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), + contextMenu(0), context1(0), context2(0), context3(0), action1(0),action2(0),action3(0),action4(0),action5(0) { QWidget *central = new QWidget(this); + contextMenu = new QMenu(); + central->setLayout(new QVBoxLayout); central->layout()->addWidget(new QPushButton); central->layout()->addWidget(new QPushButton); central->layout()->addWidget(new QPushButton); context1 = new QAction(QString("Context1"), central); context2 = new QAction(QString("Context2"), central); - context3 = new QAction(QString("Context3"), context2); + + context3 = new QAction(QString("Context3"), contextMenu); central->addAction(context1); central->addAction(context2); QMenuBar* menuBar = new QMenuBar(this); menuBar->addAction("MyMenuItem1"); this->setMenuBar(menuBar); - + context2->setMenu(contextMenu); + contextMenu->addAction(context3); + action1 = new QSoftKeyAction(QSoftKeyAction::Ok, QString("Ok"), central); action2 = new QSoftKeyAction(QSoftKeyAction::Back, QString("Back"), central); action3 = new QSoftKeyAction(QSoftKeyAction::Cancel, QString("Cancel"), central); @@ -81,6 +88,7 @@ MainWindow::~MainWindow() delete action3; delete action4; delete action5; + delete contextMenu; } int main(int argc, char *argv[]) |