no message

qt6
ATTIOT\zhengcy 2021-08-04 09:15:30 +08:00
parent 59d732cb48
commit 4d2b87be0a
3 changed files with 26 additions and 19 deletions

BIN
.gitignore vendored

Binary file not shown.

33
Qss.cpp
View File

@ -23,6 +23,7 @@
#include <QTimer> #include <QTimer>
#include <QCoreApplication> #include <QCoreApplication>
#include <QGraphicsDropShadowEffect> #include <QGraphicsDropShadowEffect>
#include <QPainterPath>
#define QSSDIALOG_SHADOW_WIDTH 12 #define QSSDIALOG_SHADOW_WIDTH 12
#define QSSDIALOG_BODER_WIDTH 0 #define QSSDIALOG_BODER_WIDTH 0
@ -285,10 +286,13 @@ QssMainWindow::QssMainWindow(QWidget *parent/* = 0*/, Qt::WindowFlags flags/* =
qDebug()<<css; qDebug()<<css;
m_frame->setStyleSheet(css); m_frame->setStyleSheet(css);
<<<<<<< Updated upstream
mShadowMask = new QWidget(this); mShadowMask = new QWidget(this);
mShadowMask->setStyleSheet("QWidget{background-color:rgba(1,1,1,0.3);}"); mShadowMask->setStyleSheet("QWidget{background-color:rgba(1,1,1,0.3);}");
mShadowMask->hide(); mShadowMask->hide();
=======
>>>>>>> Stashed changes
return; return;
} }
@ -535,6 +539,9 @@ void QssMainWindow::showEvent(QShowEvent *ev)
bool QssMainWindow::eventFilter(QObject * obj, QEvent * ev){ bool QssMainWindow::eventFilter(QObject * obj, QEvent * ev){
if (obj == m_frame) if (obj == m_frame)
{ {
if (ev->type() == QEvent::Paint){
}
if (ev->type() == QEvent::MouseMove) if (ev->type() == QEvent::MouseMove)
{ {
QMouseEvent * mouseEv = dynamic_cast<QMouseEvent *>(ev); QMouseEvent * mouseEv = dynamic_cast<QMouseEvent *>(ev);
@ -667,6 +674,11 @@ void QssMainWindow::SetScale(float scale)
} }
void QssMainWindow::paintEvent(QPaintEvent *event)
{
QWidget::paintEvent(event);
}
QssDialog::QssDialog(QWidget *parent) QssDialog::QssDialog(QWidget *parent)
: QDialog(0), : QDialog(0),
m_parent(parent), m_parent(parent),
@ -1738,7 +1750,8 @@ bool QssMaskWidget::eventFilter(QObject *obj, QEvent *ev)
if(obj != this){ if(obj != this){
if(mParent != nullptr){ if(mParent != nullptr){
if(mParent->parentWidget() != nullptr){ if(mParent->parentWidget() != nullptr){
this->move(mParent->parentWidget()->geometry().width()/2,mParent->parentWidget()->geometry().height()/2); this->move(mParent->parentWidget()->geometry().width()/2,
mParent->parentWidget()->geometry().height()/2);
this->show(); this->show();
this->raise(); this->raise();
} }
@ -1753,14 +1766,6 @@ bool QssMaskWidget::eventFilter(QObject *obj, QEvent *ev)
void QssMaskWidget::paintEvent(QPaintEvent *event) void QssMaskWidget::paintEvent(QPaintEvent *event)
{ {
// QPainter paint(this);
// auto kBackgroundColor = QColor(20, 20, 20,20);
//// kBackgroundColor.setAlpha( 1);// 透明度为0
// paint.setRenderHint(QPainter::Antialiasing, true);
// paint.setPen(Qt::NoPen);
// paint.setBrush(QBrush(kBackgroundColor, Qt::SolidPattern));//设置画刷形式
// paint.drawRect(0, 0, width(), height());
// paint.end();
QWidget::paintEvent(event); QWidget::paintEvent(event);
} }
@ -1775,19 +1780,19 @@ QSSASyncProcess::~QSSASyncProcess()
this->mThread.terminate(); this->mThread.terminate();
} }
int QSSASyncProcess::Start() int QSSASyncProcess::Start(void *p)
{ {
this->moveToThread(&mThread); this->moveToThread(&mThread);
connect(this, SIGNAL(StartRun()), this, SLOT(Run())); connect(this, SIGNAL(StartRun(void *)), this, SLOT(Run(void *)));
connect(&mThread, &QThread::finished, this, &QObject::deleteLater); connect(&mThread, &QThread::finished, this, &QObject::deleteLater);
mThread.start(); mThread.start();
emit StartRun(); emit StartRun(p);
return 0; return 0;
} }
void QSSASyncProcess::Run() void QSSASyncProcess::Run(void *)
{ {
qDebug()<<"test run";
emit(Done()); emit(Done());
} }

12
Qss.h
View File

@ -252,6 +252,8 @@ protected:
virtual void ScaleChanged(float scale) ; virtual void ScaleChanged(float scale) ;
virtual WId GetWID() const; virtual WId GetWID() const;
virtual void SetScale(float scale) ; virtual void SetScale(float scale) ;
virtual void paintEvent(QPaintEvent *event);
private: private:
QRect m_rcValid;//桌面最大可用尺寸 QRect m_rcValid;//桌面最大可用尺寸
QRect m_rcNormal;//还原后窗口尺寸 QRect m_rcNormal;//还原后窗口尺寸
@ -489,19 +491,19 @@ private:
}; };
// 异步执行任务不会阻塞ui线程 // 异步执行任务不会阻塞ui线程
class QSSASyncProcess : public QObject{ class QSSASyncProcess : public QObject{
Q_OBJECT Q_OBJECT
public: public:
QSSASyncProcess(QWidget *parent = nullptr); QSSASyncProcess(QWidget *parent = nullptr);
~QSSASyncProcess(); ~QSSASyncProcess();
int Start(); int Start(void*);
signals: signals:
void DonePercent(int); void DonePercent(int);
void Done(); void Done();
void StartRun(); void StartRun(void *);
protected slots: public slots:
virtual void Run(); virtual void Run(void *) ;
protected: protected:
QWidget *mParent; QWidget *mParent;
QThread mThread; QThread mThread;