-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmainwindow.cpp
More file actions
53 lines (36 loc) · 1.07 KB
/
Copy pathmainwindow.cpp
File metadata and controls
53 lines (36 loc) · 1.07 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
#include "mainwindow.h"
#include "./ui_mainwindow.h"
#include <QResizeEvent>
#include <algorithm>
MainWindow::MainWindow(QWidget *parent)
: QMainWindow(parent), ui(new Ui::MainWindow){
setWindowIcon(QIcon(":/resources/icons/GoMonte.png"));
ui->setupUi(this);
setWindowTitle("GoMonte v1.0");
setMinimumSize(1200,1000);
}
MainWindow::~MainWindow(){
delete ui;
}
void MainWindow::set_board(MainBoardWidget *board){
m_Board = board;
//setCentralWidget(m_Board);
}
void MainWindow::set_main_menu(MainMenuWidget *menu){
m_MainMenu = menu;
//setCentralWidget(m_MainMenu);
}
void MainWindow::resizeEvent(QResizeEvent *event){
QMainWindow::resizeEvent(event);
int w = width(), h = height();
int s = std::min(w, h);
s = std::max(750, (s*4/5)/(2*BOARD_SIZE)*(2*BOARD_SIZE));
if (m_Board != nullptr){
m_Board->setFixedSize(s, s);
m_Board->move((w-s)/2+(w-s)/4, (h-s)/4);
}
if (m_MainMenu != nullptr){
m_MainMenu->setFixedSize(3*(w-s)/8,s );
m_MainMenu->move(3*(w-s)/16, (h-s)/4);
}
}