no message

qt6
zcy 2021-05-01 01:32:54 +08:00
parent 5904f35422
commit cdd880708d
6 changed files with 53 additions and 58 deletions

30
Qss.cpp
View File

@ -23,7 +23,7 @@
#include <QTimer> #include <QTimer>
#define QSSDIALOG_SHADOW_WIDTH 12 //QFrame#dialog,QFrame#messagebox padding #define QSSDIALOG_SHADOW_WIDTH 12
#define QSSDIALOG_BODER_WIDTH 0 #define QSSDIALOG_BODER_WIDTH 0
QssTtitleBar::QssTtitleBar(QWidget *parent , QssTtitleBar::QssTtitleBar(QWidget *parent ,
@ -684,6 +684,7 @@ void QssDialog::show()
QDialog::show(); QDialog::show();
m_frame->show(); m_frame->show();
} }
void QssDockWidget::paintEvent(QPaintEvent *){ void QssDockWidget::paintEvent(QPaintEvent *){
QStyleOption opt; QStyleOption opt;
opt.init(this); opt.init(this);
@ -1612,3 +1613,30 @@ void QssToastWidget::paintEvent(QPaintEvent *event)
paint.drawRect(0, 0, width(), height()); paint.drawRect(0, 0, width(), height());
paint.end(); paint.end();
} }
QSSProcessBar::QSSProcessBar(QWidget *parent) :
QDialog(parent),
ui(new Ui::Process)
{
ui->setupUi(this);
ui->progressBar->setValue(1);
setWindowFlags(Qt::FramelessWindowHint);
this->setModal(true);
}
QSSProcessBar::~QSSProcessBar()
{
delete ui;
}
void QSSProcessBar::on_percent(int percent)
{
ui->progressBar->setValue(percent);
}
void QSSProcessBar::on_done_close()
{
this->close();
}

20
Qss.h
View File

@ -13,6 +13,8 @@
#include <QDebug> #include <QDebug>
#include "ui_qsstoast.h" #include "ui_qsstoast.h"
#include "ui_process.h"
#ifdef __MINGW32__ #ifdef __MINGW32__
#include "windows.h" #include "windows.h"
#include "winuser.h" #include "winuser.h"
@ -433,6 +435,24 @@ protected:
private: private:
Ui::Toast ui; Ui::Toast ui;
}; };
class QSSProcessBar : public QDialog
{
Q_OBJECT
public:
explicit QSSProcessBar(QWidget *parent = nullptr);
~QSSProcessBar();
public slots:
void on_percent(int);
void on_done_close();
private:
Ui::Process *ui;
};
#define tipBox(text) QssMessageBox::tips(text) #define tipBox(text) QssMessageBox::tips(text)
#define warnBox(text) QssMessageBox::warn(text) #define warnBox(text) QssMessageBox::warn(text)
#define errBox(text) QssMessageBox::error(text) #define errBox(text) QssMessageBox::error(text)

View File

@ -1,28 +0,0 @@
#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();
}

View File

@ -1,24 +0,0 @@
#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

View File

@ -1,12 +1,11 @@
INCLUDEPATH += $$PWD INCLUDEPATH += $$PWD
DEPENDPATH += $$PWD DEPENDPATH += $$PWD
HEADERS += $$PWD/Qss.h \ HEADERS += $$PWD/Qss.h
$$PWD/process.h SOURCES += $$PWD/Qss.cpp
SOURCES += $$PWD/Qss.cpp \
$$PWD/process.cpp
RESOURCES += $$PWD/qss.qrc RESOURCES += $$PWD/qss.qrc
FORMS += $$PWD/forms/qsstoast.ui \ FORMS += $$PWD/forms/qsstoast.ui \
$$PWD/process.ui $$PWD/forms/process.ui