Commit 7f4a72c1 by NitefullWind

1. 弹窗后向自己发送点击事件以获取焦点。

parent ee1406af
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
#include <QStyleOption> #include <QStyleOption>
#include <QJsonDocument> #include <QJsonDocument>
#include <QKeyEvent> #include <QKeyEvent>
#include <QTimer>
#ifdef Q_OS_WIN #ifdef Q_OS_WIN
#include <windows.h> #include <windows.h>
#include <windowsx.h> #include <windowsx.h>
...@@ -31,6 +32,13 @@ void FMVipWnd::on_close_btn_clicked() ...@@ -31,6 +32,13 @@ void FMVipWnd::on_close_btn_clicked()
this->done(-1); this->done(-1);
} }
void FMVipWnd::onWindowShown()
{
SetCursorPos(_centerPoint.x(), _centerPoint.y());
mouse_event(MOUSEEVENTF_LEFTDOWN|MOUSEEVENTF_ABSOLUTE, _centerPoint.x(), _centerPoint.y(), 0, 0);
mouse_event(MOUSEEVENTF_LEFTUP|MOUSEEVENTF_ABSOLUTE, _centerPoint.x(), _centerPoint.y(), 0, 0);
}
bool FMVipWnd::close() bool FMVipWnd::close()
{ {
if(loadingWindow != nullptr) { if(loadingWindow != nullptr) {
...@@ -63,6 +71,12 @@ int FMVipWnd::exec() ...@@ -63,6 +71,12 @@ int FMVipWnd::exec()
QRect rc = w.availableGeometry(); QRect rc = w.availableGeometry();
setGeometry((rc.width() - width()) / 2, (rc.height() - height()) / 2, width(), height()); setGeometry((rc.width() - width()) / 2, (rc.height() - height()) / 2, width(), height());
_centerPoint = rc.center();
QTimer t;
t.singleShot(5, this, &FMVipWnd::onWindowShown);
t.start();
return QDialog::exec(); return QDialog::exec();
} }
......
...@@ -26,8 +26,11 @@ public: ...@@ -26,8 +26,11 @@ public:
public slots: public slots:
void on_close_btn_clicked(); void on_close_btn_clicked();
void onWindowShown();
private: private:
FMLoading* loadingWindow; FMLoading* loadingWindow;
QPoint _centerPoint;
protected: protected:
bool _isBusy; bool _isBusy;
Session *_session; Session *_session;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment