-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmode.cpp
44 lines (35 loc) · 799 Bytes
/
mode.cpp
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
#include "mode.h"
Mode::Mode(QString name)
{
this->name = name;
active = true;
}
void Mode::activate()
{
if (active)
return;
for (int i = 0; i < dockWidgets.length(); i++)
{
dockWidgets.at(i)->setHidden(!lastVisibilities.at(i));
dockWidgets.at(i)->toggleViewAction()->setEnabled(true);
}
active = true;
}
void Mode::deactivate()
{
if (!active)
return;
for (int i = 0; i < dockWidgets.length(); i++)
lastVisibilities[i] = !dockWidgets.at(i)->isHidden();
foreach (QDockWidget* d, dockWidgets)
{
d->setHidden(true);
d->toggleViewAction()->setEnabled(false);
}
active = false;
}
void Mode::addDock(QDockWidget* dock)
{
dockWidgets.append(dock);
lastVisibilities.append(true);
}