From 4d2b87be0a568f7f6ffee9c51bb0e827bc62a300 Mon Sep 17 00:00:00 2001 From: "ATTIOT\\zhengcy" Date: Wed, 4 Aug 2021 09:15:30 +0800 Subject: [PATCH] no message --- .gitignore | Bin 1024 -> 270 bytes Qss.cpp | 33 +++++++++++++++++++-------------- Qss.h | 12 +++++++----- 3 files changed, 26 insertions(+), 19 deletions(-) diff --git a/.gitignore b/.gitignore index 028f6b1dc4921429a2433a381dadfa3a7beca1bf..259148fa18f9fb7ef58563f4ff15fc7b172339fb 100644 GIT binary patch literal 270 zcmZ9H!4AS842JJK1<7t6d)|CV~&KuUfh75?Og_4R!X8D(I&Y;-GcDnz!@Q6QSZY)MYHG@cw8nJqqh`Y zff84$vce))T8T7pN`(tdc1)oW{vIHsc&e5y^~S(|P=Y8<0uen5mqb6KZwzkz4$dg6 J)L2b9n>TW+QzQTY literal 1024 zcmcb>%n-CD=5~OVzpFuk&@7$5u`qi1A-Sdhz^?WXgja>hR zYt6^o{%Q{WrwmZ)>CM_=E zzGB#$n^kXA%PedHXh7EH3o7?E`RhXT8|Yh#^ly>6^8`L*(v z!^imWq~O%V93+KkOg11NV!1bvWv3oW_38C7Cjs-6$tM5+ diff --git a/Qss.cpp b/Qss.cpp index 41dea73..1e18d2e 100644 --- a/Qss.cpp +++ b/Qss.cpp @@ -23,6 +23,7 @@ #include #include #include +#include #define QSSDIALOG_SHADOW_WIDTH 12 #define QSSDIALOG_BODER_WIDTH 0 @@ -285,10 +286,13 @@ QssMainWindow::QssMainWindow(QWidget *parent/* = 0*/, Qt::WindowFlags flags/* = qDebug()<setStyleSheet(css); +<<<<<<< Updated upstream mShadowMask = new QWidget(this); mShadowMask->setStyleSheet("QWidget{background-color:rgba(1,1,1,0.3);}"); mShadowMask->hide(); +======= +>>>>>>> Stashed changes return; } @@ -535,6 +539,9 @@ void QssMainWindow::showEvent(QShowEvent *ev) bool QssMainWindow::eventFilter(QObject * obj, QEvent * ev){ if (obj == m_frame) { + if (ev->type() == QEvent::Paint){ + + } if (ev->type() == QEvent::MouseMove) { QMouseEvent * mouseEv = dynamic_cast(ev); @@ -667,6 +674,11 @@ void QssMainWindow::SetScale(float scale) } +void QssMainWindow::paintEvent(QPaintEvent *event) +{ + QWidget::paintEvent(event); +} + QssDialog::QssDialog(QWidget *parent) : QDialog(0), m_parent(parent), @@ -1738,7 +1750,8 @@ bool QssMaskWidget::eventFilter(QObject *obj, QEvent *ev) if(obj != this){ if(mParent != 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->raise(); } @@ -1753,14 +1766,6 @@ bool QssMaskWidget::eventFilter(QObject *obj, QEvent *ev) 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); } @@ -1775,19 +1780,19 @@ QSSASyncProcess::~QSSASyncProcess() this->mThread.terminate(); } -int QSSASyncProcess::Start() +int QSSASyncProcess::Start(void *p) { 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); mThread.start(); - emit StartRun(); + emit StartRun(p); return 0; } -void QSSASyncProcess::Run() +void QSSASyncProcess::Run(void *) { - qDebug()<<"test run"; emit(Done()); } + diff --git a/Qss.h b/Qss.h index 6489ae0..bcc70ed 100644 --- a/Qss.h +++ b/Qss.h @@ -252,6 +252,8 @@ protected: virtual void ScaleChanged(float scale) ; virtual WId GetWID() const; virtual void SetScale(float scale) ; + virtual void paintEvent(QPaintEvent *event); + private: QRect m_rcValid;//桌面最大可用尺寸 QRect m_rcNormal;//还原后窗口尺寸 @@ -489,19 +491,19 @@ private: }; // 异步执行任务,不会阻塞ui线程 -class QSSASyncProcess : public QObject{ +class QSSASyncProcess : public QObject{ Q_OBJECT public: QSSASyncProcess(QWidget *parent = nullptr); ~QSSASyncProcess(); - int Start(); + int Start(void*); signals: void DonePercent(int); void Done(); - void StartRun(); -protected slots: - virtual void Run(); + void StartRun(void *); +public slots: + virtual void Run(void *) ; protected: QWidget *mParent; QThread mThread;