-
Notifications
You must be signed in to change notification settings - Fork 0
/
navigate.cpp
149 lines (116 loc) · 3.61 KB
/
navigate.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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
#include "navigate.h"
#include "musicinterfase.h"
/**
* @author: jingbo
* @date: 2018/05/14
* @desc: 导航栏
*/
Navigate::Navigate(QWidget *parent) : QWidget(parent)
{
navIcon = new QPushButton;
loginBtn = new QPushButton;
cut = new QLabel;
registBtn = new QPushButton;
resultBtn = new QPushButton;
updateBtn = new QPushButton;
findEdit = new QLineEdit;
skinBtn = new QPushButton;
miniBtn = new QPushButton;
closeBtn = new QPushButton;
customizeSkinBtn = new QPushButton;
loginRegLayout = new QHBoxLayout;
navMainLayout = new QHBoxLayout;
setLayout(navMainLayout);
setFixedHeight(50);
setControlsLayout();
setControlsForm();
setControlsStyle();
}
QPushButton *Navigate::getResultPreBtn()
{
return resultBtn;
}
QPushButton *Navigate::getSkinBtn()
{
return skinBtn;
}
QPushButton *Navigate::getMiniBtn()
{
return miniBtn;
}
QPushButton *Navigate::getCloseBtn()
{
return closeBtn;
}
QPushButton *Navigate::getCustomizeSkinBtn()
{
return customizeSkinBtn;
}
void Navigate::setControlsLayout()
{
loginRegLayout->setMargin(0);
loginRegLayout->setSpacing(2);
loginRegLayout->addWidget(loginBtn);
loginRegLayout->addWidget(cut);
loginRegLayout->addWidget(registBtn);
navMainLayout->setMargin(12);
navMainLayout->setSpacing(10);
navMainLayout->addWidget(navIcon);
navMainLayout->addStretch(3);
navMainLayout->addWidget(customizeSkinBtn);
navMainLayout->addWidget(miniBtn);
navMainLayout->addWidget(skinBtn);
navMainLayout->addWidget(closeBtn);
}
void Navigate::setControlsForm()
{
navIcon->setFixedSize(50, 30);
navIcon->setIconSize(QSize(30, 30));
navIcon->setIcon(QIcon(":/img/icon.png"));
loginBtn->setFixedSize(30, 20);
loginBtn->setText(tr("登录"));
loginBtn->setCursor(QCursor(Qt::PointingHandCursor));
cut->setText(tr("|"));
registBtn->setFixedSize(30, 20);
registBtn->setText(tr("注册"));
registBtn->setCursor(QCursor(Qt::PointingHandCursor));
resultBtn->setFixedSize(20, 20);
resultBtn->setIconSize(QSize(20, 20));
resultBtn->setIcon(QIcon(":/img/result.png"));
resultBtn->setCursor(QCursor(Qt::PointingHandCursor));
updateBtn->setFixedSize(20, 20);
updateBtn->setIconSize(QSize(20, 20));
updateBtn->setIcon(QIcon(":/img/update.png"));
updateBtn->setCursor(QCursor(Qt::PointingHandCursor));
findEdit->setFixedSize(260, 25);
findEdit->addAction(QIcon(":/img/search2.png"), QLineEdit::TrailingPosition);
skinBtn->setFixedSize(20, 20);
skinBtn->setIconSize(QSize(20, 20));
skinBtn->setIcon(QIcon(":/img/skin.png"));
skinBtn->setCursor(QCursor(Qt::PointingHandCursor));
customizeSkinBtn->setFixedSize(100, 20);
customizeSkinBtn->setText(tr("自定义皮肤"));
//customizeSkinBtn->setFont(20)
miniBtn->setFixedSize(20, 20);
miniBtn->setIconSize(QSize(20, 20));
miniBtn->setIcon(QIcon(":/img/mini.png"));
miniBtn->setCursor(QCursor(Qt::PointingHandCursor));
closeBtn->setFixedSize(20, 20);
closeBtn->setIconSize(QSize(20, 20));
closeBtn->setIcon(QIcon(":/img/close.png"));
closeBtn->setCursor(QCursor(Qt::PointingHandCursor));
this->setWindowFlags(Qt::FramelessWindowHint);
}
void Navigate::setControlsStyle()
{
//this-> setWindowFlags(Qt::WindowStaysOnTopHint);
//this->setAutoFillBackground(true);
QFile file(QString(":/qss/navigate.qss"));
file.open(QFile::ReadOnly);
if (file.isOpen())
{
QString styleSheet = this->styleSheet();
styleSheet += QLatin1String(file.readAll());
this->setStyleSheet(styleSheet);
}
}