-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathwindowone.cpp
More file actions
63 lines (56 loc) · 1.4 KB
/
windowone.cpp
File metadata and controls
63 lines (56 loc) · 1.4 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
61
62
63
#include "windowone.h"
#include "ui_windowone.h"
#include "windowtwo.h"
WindowOne::WindowOne(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::WindowOne)
{
ui->setupUi(this);
this->skipevent_one = false;
this->installEventFilter(this);
}
void WindowOne::moveEvent(QMoveEvent *event)
{
if (this->skipevent_one ) {
return;
}
QRect ogeo;
QRect geo;
ogeo = windowTwo->geometry();
geo = this->geometry();
geo.moveLeft(geo.left() + geo.width() + 10);
geo.setHeight(ogeo.height());
geo.setWidth(ogeo.width());
windowTwo->setGeometry(geo);
}
bool WindowOne::eventFilter(QObject *watched, QEvent *event)
{
bool ret = false;
if (event->type() == QEvent::NonClientAreaMouseButtonPress) {
if (this->isMinimized()) {
this->windowTwo->skipevent_two = false;
}
else {
this->windowTwo->skipevent_two = true;
ret = false;
}
}
else if (event->type() == QEvent::NonClientAreaMouseButtonRelease) {
this->windowTwo->skipevent_two = false;
ret = false;
}
else if (event->type() == QEvent::WindowStateChange) {
if (this->isMinimized()) {
this->windowTwo->skipevent_two = false;
ret = false;
}
}
else {
ret = QMainWindow::eventFilter(watched, event);
}
return ret;
}
WindowOne::~WindowOne()
{
delete ui;
}