-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMyWindow.cpp
More file actions
55 lines (36 loc) · 1.15 KB
/
MyWindow.cpp
File metadata and controls
55 lines (36 loc) · 1.15 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
#include "MyWindow.h"
#include <QVBoxLayout>
#include "CalculatorTab.h"
#include "HomeTab.h"
#include "NotesTab.h"
#include "StringsTab.h"
#include "EncodingTab.h"
#include <QPushButton>
MyWindow::MyWindow(QWidget *parent)
: QWidget(parent)
{
QVBoxLayout *mainLayout = new QVBoxLayout(this);
tabWidget = new QTabWidget(this);
mainLayout->addWidget(tabWidget);
this->setFixedSize(this->size());
connect(tabWidget, &QTabWidget::currentChanged, this, &MyWindow::onTabChanged);
HomeTab* home = new HomeTab();
home->addToTabWidget(tabWidget);
EncodingTab* enc = new EncodingTab();
enc->addToTabWidget(tabWidget);
CalculatorTab* calc = new CalculatorTab();
calc->addToTabWidget(tabWidget);
StringsTab* strings = new StringsTab();
strings->addToTabWidget(tabWidget);
NotesTab* notes = new NotesTab();
notes->addToTabWidget(tabWidget);
}
void MyWindow::onTabChanged(int index) {
if (index == 0) {
this->resize(600,450);
this->setFixedSize(this->size());
} else {
this->setMinimumSize(400, 300);
this->setMaximumSize(QWIDGETSIZE_MAX, QWIDGETSIZE_MAX);
}
}