1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
|
#include "softkeys.h"
MainWindow::MainWindow(QWidget *parent)
: QMainWindow(parent)
{
fileMenu = menuBar()->addMenu(tr("&File"));
openDialogAct = new QAction(tr("&Open Dialog"), this);
addSoftKeysAct = new QAction(tr("&Add Softkeys"), this);
clearSoftKeysAct = new QAction(tr("&Clear Softkeys"), this);
fileMenu->addAction(openDialogAct);
fileMenu->addAction(addSoftKeysAct);
fileMenu->addAction(clearSoftKeysAct);
connect(openDialogAct, SIGNAL(triggered()), this, SLOT(openDialog()));
connect(addSoftKeysAct, SIGNAL(triggered()), this, SLOT(addSoftKeys()));
connect(clearSoftKeysAct, SIGNAL(triggered()), this, SLOT(clearSoftKeys()));
QWidget *central = new QWidget(this);
central->setLayout(new QVBoxLayout);
// central->setFocus();
setCentralWidget(central);
QPushButton button1;
// QAction* menuAction =
}
MainWindow::~MainWindow()
{
}
void MainWindow::openDialog()
{
QFileDialog::getOpenFileName(this);
}
void MainWindow::addSoftKeys()
{
ok = new QAction(tr("Ok"), this);
ok->setSoftKeyRole(QAction::OkSoftKey);
connect(ok, SIGNAL(triggered()), this, SLOT(okPressed()));
cancel = new QAction(tr("Cancel"), this);
cancel->setSoftKeyRole(QAction::OkSoftKey);
connect(cancel, SIGNAL(triggered()), this, SLOT(cancelPressed()));
QList<QAction*> softkeys;
softkeys.append(ok);
softkeys.append(cancel);
setSoftKeys(softkeys);
}
void MainWindow::clearSoftKeys()
{
setSoftKey(0);
}
void MainWindow::okPressed()
{
}
void MainWindow::cancelPressed()
{
}
|