#include "QtGuiClass.h"
#include<Windows.h>
QtGuiClass::QtGuiClass(QWidget *parent)
: QWidget(parent)
{
ui.setupUi(this);
SetWindowPos((HWND)(this->winId()), HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE);
setGeometry(0, 0, 1000, 1000);
show();
LONG nRet = ::GetWindowLong((HWND)(this->winId()), GWL_EXSTYLE);
nRet = nRet | WS_EX_LAYERED;
::SetWindowLong((HWND)(this->winId()), GWL_EXSTYLE, nRet);
SetLayeredWindowAttributes((HWND)(this->winId()), 0, 123, LWA_ALPHA);
setAttribute(Qt::WA_TranslucentBackground, true);
SetWindowLong((HWND)(this->winId()), GWL_EXSTYLE, GetWindowLong((HWND)(this->winId()), GWL_EXSTYLE) | WS_EX_NOACTIVATE);
installEventFilter(this);
}
QtGuiClass::~QtGuiClass()
{
}
bool QtGuiClass::eventFilter(QObject *target, QEvent *event)
{
qDebug("eventFilter");
if (event->type() == QEvent::MouseButtonPress)
{
qDebug("MouseButtonPress");
emit signalNext();
}
//其它部件产生的事件则交给基类处理
return QWidget::eventFilter(target, event);
}
QtGuiClass.cpp
最新推荐文章于 2022-08-24 10:17:11 发布