Commit 20527f5d by 刘帅

1. 实现支付过程中置顶窗口

parent 918e3391
...@@ -68,5 +68,4 @@ Thumbs.db ...@@ -68,5 +68,4 @@ Thumbs.db
# Binaries # Binaries
# -------- # --------
*.exe
No preview for this file type
{
{
"business_date": "20171214",
"clientReqCount": 1,
"operator_id": "001",
"partnerId": "1371",
"reqtype": 72,
"station_id": "1",
"store_id": "fm99999",
"trans_id": "201712140003",
"transactions": [
{
"amount": 2,
"code": "134638432582236320",
"products": [
{
"consume_num": 1,
"pid": "0079020",
"price": 1000
},
{
"consume_num": 1,
"pid": "0077842",
"price": 8000
}
],
"undis_amount": 0
}
],
"ver": 2,
"checkValue":32.12
}
\ No newline at end of file
...@@ -9,7 +9,7 @@ int main(int argc, char *argv[]) ...@@ -9,7 +9,7 @@ int main(int argc, char *argv[])
Widget w; Widget w;
QFmClient client; QFmClient client;
QObject::connect(&client,&QFmClient::HideUi, &w, &Widget::hide,Qt::QueuedConnection); QObject::connect(&client,&QFmClient::HideUi, &w, &Widget::hide,Qt::QueuedConnection);
QObject::connect(&client,&QFmClient::ShowUi, &w, &Widget::show,Qt::QueuedConnection); QObject::connect(&client,&QFmClient::ShowUi, &w, &Widget::showTop,Qt::QueuedConnection);
client.start(); client.start();
return a.exec(); return a.exec();
} }
...@@ -3,6 +3,8 @@ ...@@ -3,6 +3,8 @@
#include <QPixmap> #include <QPixmap>
#include <QPropertyAnimation> #include <QPropertyAnimation>
#include <Windows.h>
#pragma comment(lib, "user32.lib")
Widget::Widget(QWidget *parent) : Widget::Widget(QWidget *parent) :
QWidget(parent), QWidget(parent),
...@@ -43,3 +45,28 @@ void Widget::move() ...@@ -43,3 +45,28 @@ void Widget::move()
animation->start(); animation->start();
} }
} }
//void Widget::showTop()
//{
// hide();
// Qt::WindowFlags wf = windowFlags();
// wf = wf | Qt::WindowStaysOnTopHint;
// setWindowFlags(wf);
// showNormal();
// //show();
//}
void Widget::showTop()
{
showNormal();
HWND hForeWnd = ::GetForegroundWindow();
DWORD dwForeID = ::GetWindowThreadProcessId(hForeWnd,NULL);
DWORD dwCurID = ::GetCurrentThreadId();
::AttachThreadInput(dwCurID,dwForeID,TRUE);
::SetForegroundWindow((HWND)effectiveWinId());
::SetWindowPos( (HWND)effectiveWinId(), HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_SHOWWINDOW);
showNormal();
::SetForegroundWindow((HWND)effectiveWinId());
::AttachThreadInput(dwCurID,dwForeID,FALSE);
QWidget::show();
}
...@@ -15,6 +15,7 @@ class Widget : public QWidget ...@@ -15,6 +15,7 @@ class Widget : public QWidget
public: public:
explicit Widget(QWidget *parent = 0); explicit Widget(QWidget *parent = 0);
~Widget(); ~Widget();
void showTop();
protected slots: protected slots:
void move(); void move();
......
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