view.cpp
1.76 KB
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
#include "view.h"
/**** VIEW ****/
/*** PUBLIC ***/
View::View(QWidget *parent)
: QToolBar(parent)
, agFormat(parent)
, agCount(parent)
{
agFormat.addAction("Photo");
agFormat.actions().last()->setShortcut(Qt::ControlModifier + Qt::Key_D);
agFormat.addAction("Registered");
agFormat.actions().last()->setShortcut(Qt::ControlModifier + Qt::Key_R);
agFormat.addAction("Enhanced");
agFormat.actions().last()->setShortcut(Qt::ControlModifier + Qt::Key_E);
agFormat.addAction("Features");
agFormat.actions().last()->setShortcut(Qt::ControlModifier + Qt::Key_F);
agCount.addAction("1");
agCount.actions().last()->setShortcut(Qt::ControlModifier + Qt::Key_1);
agCount.addAction("4");
agCount.actions().last()->setShortcut(Qt::ControlModifier + Qt::Key_2);
agCount.addAction("9");
agCount.actions().last()->setShortcut(Qt::ControlModifier + Qt::Key_3);
agCount.addAction("16");
agCount.actions().last()->setShortcut(Qt::ControlModifier + Qt::Key_4);
addActions(agFormat.actions());
addSeparator();
addActions(agCount.actions());
setToolTip("View");
connect(&agFormat, SIGNAL(triggered(QAction*)), this, SLOT(formatChanged(QAction*)));
connect(&agCount, SIGNAL(triggered(QAction*)), this, SLOT(countChanged(QAction*)));
foreach (QAction *action, agCount.actions())
action->setCheckable(true);
agCount.actions()[2]->setChecked(true);
foreach (QAction *action, agFormat.actions())
action->setCheckable(true);
agFormat.actions()[1]->setChecked(true);
}
/*** PRIVATE SLOTS ***/
void View::formatChanged(QAction *action)
{
emit newFormat(action->text());
}
void View::countChanged(QAction *action)
{
emit newCount(action->text().toInt());
}
#include "moc_view.cpp"