chore: update framelesshelper

This commit is contained in:
rankun 2020-10-12 12:49:46 +08:00
parent 2d81950e3f
commit d33e8a7eff
3 changed files with 38 additions and 6 deletions

View file

@ -11,7 +11,6 @@
#include "dialog.h"
#include "mousetap/mousetap.h"
#include "stream.h"
#include "windownativeeventfilter.h"
#include "windowframelesshelper.h"
static Dialog *g_mainDlg = Q_NULLPTR;
@ -80,10 +79,6 @@ int main(int argc, char *argv[])
QQmlApplicationEngine engine("qrc:/MainWindow.qml");
#ifdef Q_OS_WIN32
WindowNativeEventFilter::Instance()->Init();
#endif
// windows下通过qmake VERSION变量或者rc设置版本号和应用名称后这里可以直接拿到
// mac下拿到的是CFBundleVersion的值
qDebug() << app.applicationVersion();

View file

@ -10,5 +10,16 @@ HEADERS += \
SOURCES += \
$$PWD/keepratiowidget.cpp \
$$PWD/magneticwidget.cpp \
$$PWD/windowframelesshelper.mm \
$$PWD/windownativeeventfilter.cpp
win32 {
SOURCES += $$PWD/windowframelesshelper.cpp
}
mac {
SOURCES += $$PWD/windowframelesshelper.mm
}
linux {
SOURCES += $$PWD/windowframelesshelper.cpp
}

View file

@ -0,0 +1,26 @@
#include "windowframelesshelper.h"
#include "windownativeeventfilter.h"
WindowFramelessHelper::WindowFramelessHelper(QObject *parent) : QObject(parent)
{
}
QQuickWindow *WindowFramelessHelper::target() const
{
return m_target;
}
void WindowFramelessHelper::setTarget(QQuickWindow *target)
{
if (target == m_target) {
return;
}
m_target = target;
#ifdef Q_OS_WIN32
WindowNativeEventFilter::Instance()->Init();
#endif
emit targetChanged();
}