diff options
author | Markku Luukkainen <markku.luukkainen@digia.com> | 2009-05-12 13:31:18 (GMT) |
---|---|---|
committer | Markku Luukkainen <markku.luukkainen@digia.com> | 2009-05-12 13:31:18 (GMT) |
commit | 9ef6e374126ba212bccbf3cf61f86f8412099c49 (patch) | |
tree | 68b3ba6df8fbcfbf2f79d3abfbcb11ffab2c2783 /src | |
parent | 61b111228d0abf66130b229fcb6c5e2a54faecbf (diff) | |
download | Qt-9ef6e374126ba212bccbf3cf61f86f8412099c49.zip Qt-9ef6e374126ba212bccbf3cf61f86f8412099c49.tar.gz Qt-9ef6e374126ba212bccbf3cf61f86f8412099c49.tar.bz2 |
Initial naive implementation for menu softkey
Diffstat (limited to 'src')
-rw-r--r-- | src/gui/softkeys/main.cpp | 29 | ||||
-rw-r--r-- | src/gui/softkeys/qsoftkeyaction.h | 1 |
2 files changed, 21 insertions, 9 deletions
diff --git a/src/gui/softkeys/main.cpp b/src/gui/softkeys/main.cpp index e5a7065..a61e512 100644 --- a/src/gui/softkeys/main.cpp +++ b/src/gui/softkeys/main.cpp @@ -11,8 +11,8 @@ #include <QApplication> #include <QMainWindow> -#include <QPushButton> -#include <QVBoxLayout> +#include <QMenuBar> + #include "qsoftkeystack.h" class MainWindow : public QMainWindow @@ -26,22 +26,26 @@ public: MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent) { - QWidget *central = new QWidget(this); - QVBoxLayout *layout = new QVBoxLayout(central); - QPushButton *button = new QPushButton("Hello"); - layout->addWidget(button); + QWidget *central = new QWidget(this); + + QMenuBar* menuBar = new QMenuBar(this); + menuBar->addAction("MyMenuItem1"); + this->setMenuBar(menuBar); QSoftKeyStack *stack = new QSoftKeyStack(central); QSoftKeyAction action1(central); - action1.setText(QString("text1")); + action1.setText(QString("Ok")); action1.setRole(QSoftKeyAction::Ok); QSoftKeyAction action2(central); - action2.setText(QString("text2")); + action2.setText(QString("Back")); action2.setRole(QSoftKeyAction::Back); QSoftKeyAction action3(central); - action3.setText(QString("text3")); + action3.setText(QString("Cancel")); action3.setRole(QSoftKeyAction::Cancel); + QSoftKeyAction action4(central); + action4.setText(QString("Menu")); + action4.setRole(QSoftKeyAction::Menu); QList<QSoftKeyAction*> myActionList; myActionList.append(&action1); @@ -50,6 +54,13 @@ MainWindow::MainWindow(QWidget *parent) stack->push(myActionList); stack->pop(); stack->push(&action1); + stack->pop(); + + QList<QSoftKeyAction*> myActionList2; + myActionList2.append(&action4); + myActionList2.append(&action1); + stack->push(myActionList2); + setCentralWidget(central); } diff --git a/src/gui/softkeys/qsoftkeyaction.h b/src/gui/softkeys/qsoftkeyaction.h index 85f5bc7..76be8ee 100644 --- a/src/gui/softkeys/qsoftkeyaction.h +++ b/src/gui/softkeys/qsoftkeyaction.h @@ -36,6 +36,7 @@ public: RevertEdit, Deselect, Finish, + Menu, Custom }; |