-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathExample.cpp
More file actions
60 lines (47 loc) · 1.61 KB
/
Example.cpp
File metadata and controls
60 lines (47 loc) · 1.61 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
58
59
60
#include "QTabFramework.hpp"
#include <QSettings>
#include <QLineEdit>
#include <QMenuBar>
#include <QApplication>
class MainWindow : public QTabFramework
{
public:
MainWindow() : settings(QSettings::IniFormat, QSettings::UserScope, "QTabFrameworkTest", "QTabFrameworkTest")
{
resize(QSize(800, 600));
QLineEdit* testWidget1 = new QLineEdit("Test.cpp");
testWidget1->setWindowTitle(tr("Test.cpp"));
QLineEdit* testWidget2 = new QLineEdit("Test2.cpp");
testWidget2->setWindowTitle(tr("Test2.cpp"));
QLineEdit* testWidget3 = new QLineEdit("Solution Explorer");
testWidget3->setWindowTitle(tr("Solution Explorer"));
QLineEdit* testWidget4 = new QLineEdit("Output");
testWidget4->setWindowTitle(tr("Output"));
addTab(testWidget1);
addTab(testWidget2, QTabFramework::InsertOnTop, testWidget1);
addTab(testWidget3, QTabFramework::InsertLeft, testWidget1);
addTab(testWidget4, QTabFramework::InsertBottom, testWidget1);
QMenuBar* menuBar = this->menuBar();
QMenu* menu = menuBar->addMenu(tr("&View"));
menu->addAction(toggleViewAction(testWidget1));
menu->addAction(toggleViewAction(testWidget2));
menu->addAction(toggleViewAction(testWidget3));
menu->addAction(toggleViewAction(testWidget4));
restoreLayout(settings.value("layout").toByteArray());
}
private:
void closeEvent(QCloseEvent* event)
{
settings.setValue("layout", saveLayout());
QTabFramework::closeEvent(event);
}
private:
QSettings settings;
};
int main(int argc, char **argv)
{
QApplication app(argc, argv);
MainWindow mainWindow;
mainWindow.show();
return app.exec();
}