-
Notifications
You must be signed in to change notification settings - Fork 1
/
subwin.cpp
82 lines (65 loc) · 1.46 KB
/
subwin.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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
#include "subwin.h"
#include "ui_subwin.h"
#include <QDebug>
SubWin::SubWin(QWidget *parent) :
QWidget(parent),
ui(new Ui::SubWin)
{
ui->setupUi(this);
this->setWindowFlag(Qt::FramelessWindowHint);
this->setWindowFlag(Qt::WindowStaysOnTopHint);
connect(ui->btnAdd,&QPushButton::clicked,[this]()
{
emit addModelSignal();
});
ui->comRate->addItem("30");
ui->comRate->addItem("60");
ui->comRate->addItem("90");
ui->comRate->addItem("120");
ui->comRate->setCurrentIndex(1);
connect(ui->comRate,QOverload<int>::of(&QComboBox::currentIndexChanged),[this](int index)
{
emit changeRate(index+1);
});
connect(ui->btnClose,&QPushButton::clicked,[this]()
{
this->hide();
});
ui->btnClose->setIcon(style()->standardIcon(QStyle::SP_TitleBarCloseButton));
loadQss();
}
SubWin::~SubWin()
{
delete ui;
}
void SubWin::loadQss()
{
// QFile file(":/style/subWin.qss");
// if(file.open(QIODevice::ReadOnly))
// {
// this->setStyleSheet(file.readAll());
// }
}
void SubWin::mouseMoveEvent(QMouseEvent*event)
{
if(isPressed)
{
this->move(event->pos()-curPos+this->pos());
}
}
void SubWin::mousePressEvent(QMouseEvent*event)
{
if(event->button()==Qt::LeftButton)
{
isPressed=true;
curPos=event->pos();
}
}
void SubWin::mouseReleaseEvent(QMouseEvent*event)
{
isPressed=false;
}
void SubWin::hideWin()
{
this->hide();
}