Commit 7f4a72c1 by NitefullWind

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

parent ee1406af
......@@ -4,6 +4,7 @@
#include <QStyleOption>
#include <QJsonDocument>
#include <QKeyEvent>
#include <QTimer>
#ifdef Q_OS_WIN
#include <windows.h>
#include <windowsx.h>
......@@ -31,6 +32,13 @@ void FMVipWnd::on_close_btn_clicked()
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()
{
if(loadingWindow != nullptr) {
......@@ -63,6 +71,12 @@ int FMVipWnd::exec()
QRect rc = w.availableGeometry();
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();
}
......
......@@ -26,8 +26,11 @@ public:
public slots:
void on_close_btn_clicked();
void onWindowShown();
private:
FMLoading* loadingWindow;
QPoint _centerPoint;
protected:
bool _isBusy;
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