添加封装好的processbar

qt6
ATTIOT\zhengcy 2021-04-30 16:56:46 +08:00
parent 5407bf8b1e
commit f54bef7ae9
9 changed files with 208 additions and 421 deletions

BIN
.gitignore vendored

Binary file not shown.

View File

@ -85,7 +85,7 @@ QssTtitleBar::QssTtitleBar(QWidget *parent ,
installEventFilter(this);
m_rcValid = QApplication::desktop()->availableGeometry();
this->setFixedHeight(37);
this->setFixedHeight(25);
setWindowFlags(windowFlags()|Qt::MSWindowsFixedSizeDialogHint);
this->setGeometry(parent->geometry().x(),parent->geometry().y(),0,0);
m_rcNormal = parentWidget()->geometry();
@ -242,6 +242,8 @@ void QssMainWindow::OnMaxOrRestore(bool max)
this->setFixedHeight(rc.height());
}
}
QssMainWindow::QssMainWindow(QWidget *parent/* = 0*/, Qt::WindowFlags flags/* = 0*/,float scale)
: QMainWindow(parent, flags),
ICallDPIChanged(),
@ -1590,7 +1592,7 @@ void QssToastWidget::showTip(const QString& text, QWidget* parent /*= nullptr*/)
QssToastWidget* toast = new QssToastWidget(parent);
toast->setWindowFlags(toast->windowFlags() | Qt::WindowStaysOnTopHint);
toast->setText(text);
toast->setStyleSheet("font:bold;font-size:24px;color:rgb(255,255,255);");
toast->setStyleSheet("font:bold;font-size:10px;color:rgb(255,255,255);");
toast->adjustSize();
QScreen* pScreen = QGuiApplication::primaryScreen();
toast->move((pScreen->size().width() - toast->width()) / 2,

1
Qss.h
View File

@ -160,7 +160,6 @@ protected:
void mouseMoveEvent(QMouseEvent * ev);
void mousePressEvent(QMouseEvent * ev);
void mouseReleaseEvent(QMouseEvent * ev);
bool eventFilter(QObject * obj, QEvent * ev);
private:

View File

@ -1,26 +1,26 @@
QWidget#qssTitleBar{
color: white;
background: rgb(7,71,166);
background: rgb(51,101,177);
border: 0px;
margin: 0px;
}
QWidget#qssTitleBar > QPushButton#titlebaricon{
background: rgb(7,71,166);
width: 30px;
height:30px;
background: rgb(51,101,177);
width: 25px;
height:25px;
}
QWidget#qssTitleBar>QPushButton#titlebarclosebtn{
QWidget#qssTitleBar > QPushButton#titlebarclosebtn{
image: url(":/qss/icon/btn_close_down.svg");
background: rgb(7,71,166);
width: 40px;
height:30px;
background: rgb(51,101,177);
width: 25px;
height:25px;
margin-left: 1px;
}
QWidget#qssTitleBar >QPushButton#titlebarmaxbtn{
background: rgb(7,71,166);
width: 40px;
height:30px;
background: rgb(51,101,177);
width: 25px;
height:25px;
margin-left: 1px;
image: url(":/qss/icon/btn_max_normal.svg");
@ -30,9 +30,9 @@ QWidget#qssTitleBar >QPushButton#titlebarclosebtn:enabled:hover{
}
QWidget#qssTitleBar >QPushButton#titlebarminbtn{
image: url(":/qss/icon/btn_mini_down.svg");
background: rgb(7,71,166);
width: 40px;
height:30px;
background: rgb(51,101,177);
width: 25px;
height:25px;
margin-left: 1px;
}
QWidget#qssTitleBar >QPushButton#titlebarminbtn:enabled:hover{
@ -41,8 +41,8 @@ QWidget#qssTitleBar >QPushButton#titlebarminbtn:enabled:hover{
QWidget#qssTitleBar >QPushButton#titlebarrestorebtn{
image: url(":/qss/icon/btn_max_normal.svg");
background: rgb(187, 212, 238);
width: 40px;
height:30px;
width: 25px;
height:25px;
margin-left: 1px;
margin-right: 2px;
}
@ -58,7 +58,7 @@ QWidget#qssTitleBar >QPushButton#titlebarmaxbtn:enabled:hover{
}
QWidget#qssTitleBar > QLabel#title{
color: white;
font-size:30px;
font-family:'Courier New', Courier, monospace;
font-size:15px;
font-family:'黑体', Courier, monospace;
}

View File

@ -1,24 +1,12 @@
QssDockWidget#dialog{
border: 1px solid rgb(111, 156, 207);
font-size : 15px;
padding: 5px;
background: rgb(232, 241, 252);
}
QDialog{
border: 1px solid rgb(rgb(0, 78, 161));
font-size : 15px;
padding: 5px;
background: rgb(232, 241, 252);
}
QWidget#player{
border: 1px solid rgb(111, 156, 207);
font-size : 15px;
background: rgb(232, 241, 252);
}
QMainWindow{
border: none;
background: rgb(245, 252, 252);
background: rgb(255, 255, 255);
}
QMainWindow::title{
@ -27,79 +15,17 @@ QMainWindow::title{
padding-left: 5px;
}
QDialog::title{
text-align: left; /* align the text to the left */
background: lightgray;
padding-left: 5px;
}
QPushButton#btn_serial:enabled {
border-image: url(:/qss/icon/btn_serial.png);
background: rgb(232, 241, 252);
color: white;
margin-left: 10;
margin-top:5;
}
QPushButton#btn_serial:enabled:hover{
background: rgb(100, 160, 220);
}
QPushButton#btn_serial:enabled:pressed{
background: rgb(0, 78, 161);
}
QPushButton#btn_process:enabled {
border-image: url(:/qss/icon/charts.png);
background: rgb(232, 241, 252);
color: white;
margin-left: 10;
margin-top:5;
}
QPushButton#btn_process:!enabled {
background: rgb(180, 180, 180);
color: white;
}
QPushButton#btn_process:enabled:hover{
background: rgb(100, 160, 220);
}
QPushButton#btn_process:enabled:pressed{
background: rgb(0, 78, 161);
}
QWidget {
font-size: 20px;
/* font-size: 10px;*/
}
QWidget#customWidget {
background: rgb(173, 202, 232);
}
/**********子界面中央背景**********/
QWidget#centerWidget {
background: rgb(232, 241, 1);
}
/**********主界面样式**********/
QWidget#mainWindow {
background: rgb(232, 241, 252);
}
QWidget#messageWidget {
background: rgba(173, 202, 232);
}
QWidget#loadingWidget {
border: none;
background: rgb(187, 212, 238);
}
QDockWidget{
background: rgb(187, 212, 238);
}
QFrame#window{
/*QFrame#window{
background: rgba(244,245,247,100);
}
}*/
QWidget#remoteWidget {
border-top-right-radius: 10px;
@ -122,9 +48,9 @@ QProgressIndicator {
/**********提示**********/
QToolTip{
border: 1px solid rgb(111, 156, 207);
background: white;
color: rgb(51, 51, 51);
border: 1px solid rgb(111, 156, 207);
background: white;
color: rgb(51, 51, 51);
}
/**********菜单栏**********/
@ -133,25 +59,27 @@ QMenuBar {
border: 1px solid rgb(111, 156, 207);
border-left: none;
border-right: none;
}
QMenuBar::item {
border: 1px solid transparent;
padding: 5px 10px 5px 10px;
height : 30px;
background: transparent;
background: "white";
text-aligin: center;
font-size: 15px;
font-size: 20px;;
}
QMenuBar::item:enabled {
color: rgb(7,71,166);
font-size: 20px;;
background: rgb(198, 224, 252);
}
QMenuBar::item:!enabled {
color: rgb(155, 155, 155);
font-size: 20px;;
background: rgb(198, 224, 252);
}
QMenuBar::item:enabled:selected {
border-top-color: rgb(111, 156, 207);
border-bottom-color: rgb(111, 156, 207);
background: rgb(198, 224, 252);
font-size: 20px;;
background: rgb(198, 224, 252);
}
/**********菜单**********/
@ -165,89 +93,25 @@ QMenu {
QssMessageBox#messagebox{
background: rgb(0, 0, 250);
}
QWidget#titlebar{
color: white;
background: rgb(7,71,166);
border: 0px;
margin: 0px;
}
QPushButton#titlebaricon{
/* image: url(:/qss/icon/logo.png);*/
background: rgb(7,71,166);
width: 30px;
height:30px;
}
QLable#titlebartitle1{
font-family:"微软雅黑";
color: white;
font-size: 16px;
}
QPushButton#titlebarclosebtn{
image: url(":/qss/icon/btn_close_down.svg");
background: rgb(7,71,166);
width: 40px;
height:30px;
margin-left: 1px;
}
QPushButton#titlebarmaxbtn{
background: rgb(7,71,166);
width: 40px;
height:30px;
margin-left: 1px;
image: url(":/qss/icon/btn_max_normal.svg");
}
QPushButton#titlebarclosebtn:enabled:hover{
background: red;
}
QPushButton#titlebarminbtn{
image: url(":/qss/icon/btn_mini_down.svg");
background: rgb(7,71,166);
width: 40px;
height:30px;
margin-left: 1px;
}
QPushButton#titlebarminbtn:enabled:hover{
background: rgb(187, 212, 238);
}
QPushButton#titlebarrestorebtn{
image: url(":/qss/icon/btn_max_normal.svg");
background: rgb(187, 212, 238);
width: 40px;
height:30px;
margin-left: 1px;
}
QPushButton#titlebarrestorebtn:enabled:hover{
background: rgb(187, 212, 238);
}
QPushButton#btn_serial:!enabled {
background: rgb(180, 180, 180);
color: white;
}
QPushButton#titlebarmaxbtn:enabled:hover{
background: rgb(100, 160, 220);
}
QMenu::item {
height: 22px;
padding: 0px 25px 0px 20px;
}
QMenu::item:enabled {
color: rgb(84, 84, 84);
}
QMenu::item:!enabled {
color: rgb(155, 155, 155);
}
QMenu::item:enabled:selected {
color: rgb(2, 65, 132);
background: rgba(255, 255, 255, 200);
}
QMenu::separator {
height: 1px;
background: rgb(111, 156, 207);
@ -256,6 +120,7 @@ QMenu::indicator {
width: 13px;
height: 13px;
}
QMenu::icon {
padding-left: 2px;
padding-right: 2px;
@ -269,6 +134,7 @@ QStatusBar {
border-right: none;
border-bottom: none;
}
QStatusBar::item {
border: none;
border-right: 1px solid rgb(111, 156, 207);
@ -276,16 +142,17 @@ QStatusBar::item {
/**********分组框**********/
QGroupBox {
font-size: 15px;
border: 1px solid rgb(111, 156, 207);
border-radius: 4px;
margin-top: 10px;
border: 1px solid rgb(111, 156, 207);
border-radius: 4px;
margin-top: 10px;
}
QGroupBox::title {
color: rgb(56, 99, 154);
top: -12px;
left: 10px;
}
QTabWidget{
margin-left:10;
}
@ -295,9 +162,11 @@ QTabWidget::pane {
border-top: 3px solid rgb(0, 78, 161);
background: rgb(187, 212, 238);
}
QTabWidget::tab-bar {
border: none;
}
QTabBar::tab {
border: none;
border-top-left-radius: 4px;
@ -310,9 +179,11 @@ QTabBar::tab {
padding-left: 5px;
padding-right: 5px;
}
QTabBar::tab:hover {
background: rgb(0, 78, 161);
}
QTabBar::tab:selected {
color: white;
background: rgb(0, 78, 161);
@ -705,62 +576,62 @@ QLineEdit:!enabled {
/**********文本编辑框**********/
QTextEdit {
border: 1px solid rgb(111, 156, 207);
color: rgb(70, 71, 73);
background: rgb(187, 212, 238);
border: 1px solid rgb(111, 156, 207);
color: rgb(70, 71, 73);
background: rgb(187, 212, 238);
}
/**********滚动区域**********/
QScrollArea {
border: 1px solid rgb(111, 156, 207);
background: rgb(187, 212, 238);
border: 1px solid rgb(111, 156, 207);
background: rgb(187, 212, 238);
}
/**********滚动区域**********/
QWidget#transparentWidget {
background: transparent;
background: transparent;
}
/**********微调器**********/
QSpinBox {
border-radius: 4px;
height: 24px;
min-width: 40px;
border: 1px solid rgb(111, 156, 207);
background: white;
border-radius: 4px;
height: 24px;
min-width: 40px;
border: 1px solid rgb(111, 156, 207);
background: white;
}
QSpinBox:enabled {
color: rgb(60, 60, 60);
color: rgb(60, 60, 60);
}
QSpinBox:enabled:hover, QSpinBox:enabled:focus {
color: rgb(51, 51, 51);
color: rgb(51, 51, 51);
}
QSpinBox:!enabled {
color: rgb(210, 210, 210);
background: transparent;
color: rgb(210, 210, 210);
background: transparent;
}
QSpinBox::up-button {
border-left: 1px solid rgb(111, 156, 207);
width: 18px;
height: 12px;
border-top-right-radius: 4px;
image: url(:/White/upButton);
border-left: 1px solid rgb(111, 156, 207);
width: 18px;
height: 12px;
border-top-right-radius: 4px;
image: url(:/White/upButton);
}
QSpinBox::up-button:!enabled {
background: transparent;
background: transparent;
}
QSpinBox::up-button:enabled:hover {
background: rgb(255, 255, 255, 30);
background: rgb(255, 255, 255, 30);
}
QSpinBox::down-button {
border-left: 1px solid rgb(111, 156, 207);
width: 18px;
height: 12px;
border-bottom-right-radius: 4px;
image: url(:/White/downButton);
border-left: 1px solid rgb(111, 156, 207);
width: 18px;
height: 12px;
border-bottom-right-radius: 4px;
image: url(:/White/downButton);
}
QSpinBox::down-button:!enabled {
background: transparent;
background: transparent;
}
QSpinBox::down-button:hover {
background: rgb(255, 255, 255, 30);
@ -772,7 +643,6 @@ QLabel#label_3{
}
QDockWidget *{
font-size: 15px;
}
/**********标签**********/
QLabel#grayLabel {
@ -801,22 +671,22 @@ QLabel#listLabel {
}
QLabel#lineBlueLabel {
background: rgb(0, 78, 161);
background: rgb(0, 78, 161);
}
QLabel#graySeperateLabel {
background: rgb(200, 220, 230);
background: rgb(200, 220, 230);
}
QLabel#seperateLabel {
background: rgb(112, 153, 194);
background: rgb(112, 153, 194);
}
QLabel#radiusBlueLabel {
border-radius: 15px;
color: white;
font-size: 18px;
background: rgb(0, 78, 161);
border-radius: 15px;
color: white;
font-size: 18px;
background: rgb(0, 78, 161);
}
QLabel#skinLabel[colorProperty="normal"] {
@ -878,218 +748,32 @@ QToolButton#transferButton {
qproperty-iconSize: 32px 32px;
qproperty-toolButtonStyle: ToolButtonTextUnderIcon;
}
QToolButton#transferButton:hover {
background: rgb(187, 212, 238);
}
/**********按钮**********/
QPushButton{
border: none;
width: 75px;
height: 25px;
font-size: 18px;
color: black;
border: none; /*去除边框*/
font-size: 15px;
}
QPushButton:enabled {
background: rgb(120, 170, 220);
color: white;
background: rgb(0, 78, 161);
color: white;
}
QPushButton:!enabled {
background: rgb(180, 180, 180);
color: white;
}
QPushButton:enabled:hover{
background: rgb(100, 160, 220);
}
QPushButton:enabled:pressed{
background: rgb(0, 78, 161);
}
QPushButton#blueButton {
color: white;
}
QPushButton#blueButton:enabled {
background: rgb(0, 78, 161);
color: white;
}
QPushButton#blueButton:enabled:hover {
background: rgb(2, 65, 132);
}
QPushButton#blueButton:enabled:pressed {
background: rgb(6, 94, 187);
}
QPushButton#selectButton {
border: none;
border-radius: none;
border-left: 1px solid rgb(111, 156, 207);
background: transparent;
image: url(:/White/scan);
color: rgb(51, 51, 51);
}
QPushButton#selectButton:enabled:hover{
background: rgb(187, 212, 238);
}
QPushButton#selectButton:enabled:pressed{
background: rgb(120, 170, 220);
}
QPushButton#linkButton {
background: transparent;
color: rgb(0, 160, 230);
text-align:left;
}
QPushButton#linkButton:hover {
color: rgb(20, 185, 255);
text-decoration: underline;
}
QPushButton#linkButton:pressed {
color: rgb(0, 160, 230);
}
QPushButton#transparentButton {
background: transparent;
}
/*****************标题栏按钮*******************/
QPushButton#minimizeButton {
border-radius: none;
border-bottom-left-radius: 4px;
border-bottom-right-radius: 4px;
background: rgb(120, 170, 220);
image: url(:/White/minimizeHover);
}
QPushButton#minimizeButton:hover {
image: url(:/White/minimize);
}
QPushButton#minimizeButton:pressed {
}
QPushButton#closeButton {
border-radius: none;
border-bottom-left-radius: 4px;
border-bottom-right-radius: 4px;
background: rgb(120, 170, 220);
image: url(:/qss/icon/btn_close_normal.png);
}
QPushButton#closeButton:hover {
background: rgb(100, 160, 220);
}
QPushButton#closeButton:pressed {
border-radius: none;
border-bottom-left-radius: 4px;
border-bottom-right-radius: 4px;
background: rgb(80, 170, 220);
}
QPushButton#skinButton {
border-radius: none;
border-bottom-left-radius: 4px;
border-bottom-right-radius: 4px;
background: rgb(120, 170, 220);
image: url(:/White/skinHover);
}
QPushButton#skinButton:hover {
image: url(:/White/skin);
}
QPushButton#skinButton:pressed {
image: url(:/White/skinPressed);
}
QPushButton#feedbackButton {
border-radius: none;
border-bottom-left-radius: 4px;
border-bottom-right-radius: 4px;
background: rgb(120, 170, 220);
image: url(:/White/feedbackHover);
}
QPushButton#feedbackButton:hover {
image: url(:/White/feedback);
}
QPushButton#feedbackButton:pressed {
image: url(:/White/feedbackPressed);
}
QPushButton#closeTipButton {
border-radius: none;
border-image: url(:/White/close);
background: transparent;
}
QPushButton#closeTipButton:hover {
border-image: url(:/White/closeHover);
}
QPushButton#closeTipButton:pressed {
border-image: url(:/White/closePressed);
}
QPushButton#changeSkinButton{
border-radius: 4px;
border: 2px solid rgb(111, 156, 207);
background: rgb(204, 227, 252);
}
QPushButton#changeSkinButton:hover{
border-color: rgb(60, 150, 200);
}
QPushButton#changeSkinButton:pressed, QPushButton#changeSkinButton:checked{
border-color: rgb(0, 160, 230);
}
QPushButton#transferButton {
padding-left: 5px;
padding-right: 5px;
color: white;
background: rgb(0, 78, 161);
}
QPushButton#transferButton:hover {
background: rgb(2, 65, 132);
}
QPushButton#transferButton:pressed {
background: rgb(6, 94, 187);
}
QPushButton#transferButton[iconProperty="left"] {
qproperty-icon: url(:/White/left);
}
QPushButton#transferButton[iconProperty="right"] {
qproperty-icon: url(:/White/right);
}
QPushButton#openButton {
border-radius: none;
image: url(:/White/open);
background: transparent;
}
QPushButton#openButton:hover {
image: url(:/White/openHover);
}
QPushButton#openButton:pressed {
image: url(:/White/openPressed);
}
QPushButton#deleteButton {
border-radius: none;
image: url(:/White/delete);
background: transparent;
}
QPushButton#deleteButton:hover {
image: url(:/White/deleteHover);
}
QPushButton#deleteButton:pressed {
image: url(:/White/deletePressed);
}
QPushButton#menuButton {
height: 50px;
text-align: left center;
padding-left: 3px;
color: rgb(84, 84, 198);
border: 1px solid rgb(111, 156, 207);
background: white;
}
QPushButton#menuButton::menu-indicator{
subcontrol-position: right center;
subcontrol-origin: padding;
padding-right: 3px;
height:50px;
background: rgb(120, 170, 220);
}

28
process.cpp Normal file
View File

@ -0,0 +1,28 @@
#include "process.h"
#include "ui_process.h"
Process::Process(QWidget *parent) :
QDialog(parent),
ui(new Ui::Process)
{
ui->setupUi(this);
ui->progressBar->setValue(1);
setWindowFlags(Qt::FramelessWindowHint);
this->setModal(true);
}
Process::~Process()
{
delete ui;
}
void Process::on_percent(int percent)
{
ui->progressBar->setValue(percent);
}
void Process::on_done_close()
{
this->close();
}

24
process.h Normal file
View File

@ -0,0 +1,24 @@
#ifndef PROCESS_H
#define PROCESS_H
#include "Qss.h"
namespace Ui {
class Process;
}
class Process : public QDialog
{
Q_OBJECT
public:
explicit Process(QWidget *parent = nullptr);
~Process();
public slots:
void on_percent(int);
void on_done_close();
private:
Ui::Process *ui;
};
#endif // PROCESS_H

51
process.ui Normal file
View File

@ -0,0 +1,51 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>Process</class>
<widget class="QDialog" name="Process">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>324</width>
<height>88</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="windowTitle">
<string>Dialog</string>
</property>
<widget class="QProgressBar" name="progressBar">
<property name="geometry">
<rect>
<x>30</x>
<y>50</y>
<width>281</width>
<height>31</height>
</rect>
</property>
<property name="value">
<number>24</number>
</property>
</widget>
<widget class="QLabel" name="label">
<property name="geometry">
<rect>
<x>120</x>
<y>30</y>
<width>121</width>
<height>16</height>
</rect>
</property>
<property name="text">
<string>正在加载数据</string>
</property>
</widget>
</widget>
<resources/>
<connections/>
</ui>

View File

@ -1,13 +1,12 @@
INCLUDEPATH += $$PWD
DEPENDPATH += $$PWD
include($$PWD/extserial/src/qextserialport.pri)
HEADERS += $$PWD/Qss.h
SOURCES += $$PWD/Qss.cpp
HEADERS += $$PWD/Qss.h \
$$PWD/process.h
SOURCES += $$PWD/Qss.cpp \
$$PWD/process.cpp
RESOURCES += $$PWD/qss.qrc
FORMS += $$PWD/forms/qsstoast.ui
FORMS += $$PWD/forms/qsstoast.ui \
$$PWD/process.ui