Fix Linux build.
Signed-off-by: Yuhang Zhao <2546789017@qq.com>
This commit is contained in:
parent
ae92a00628
commit
c0de790138
|
@ -4,6 +4,7 @@ DEFINES += \
|
||||||
QT_NO_CAST_FROM_ASCII \
|
QT_NO_CAST_FROM_ASCII \
|
||||||
QT_NO_CAST_TO_ASCII \
|
QT_NO_CAST_TO_ASCII \
|
||||||
FRAMELESSHELPER_STATIC
|
FRAMELESSHELPER_STATIC
|
||||||
|
RESOURCES += $$PWD/resources.qrc
|
||||||
HEADERS += \
|
HEADERS += \
|
||||||
$$PWD/../framelesshelper_global.h \
|
$$PWD/../framelesshelper_global.h \
|
||||||
$$PWD/../framelesswindowsmanager.h
|
$$PWD/../framelesswindowsmanager.h
|
||||||
|
@ -18,7 +19,6 @@ win32 {
|
||||||
DEFINES += WNEF_LINK_SYSLIB
|
DEFINES += WNEF_LINK_SYSLIB
|
||||||
LIBS += -luser32 -lgdi32 -ldwmapi -lshcore -ld2d1
|
LIBS += -luser32 -lgdi32 -ldwmapi -lshcore -ld2d1
|
||||||
}
|
}
|
||||||
RESOURCES += $$PWD/windows.qrc
|
|
||||||
RC_FILE = $$PWD/windows.rc
|
RC_FILE = $$PWD/windows.rc
|
||||||
OTHER_FILES += $$PWD/windows.manifest
|
OTHER_FILES += $$PWD/windows.manifest
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -81,7 +81,7 @@ FramelessHelper::FramelessHelper(QObject *parent) : QObject(parent) {}
|
||||||
void FramelessHelper::updateQtFrame(QWindow *window, const int titleBarHeight)
|
void FramelessHelper::updateQtFrame(QWindow *window, const int titleBarHeight)
|
||||||
{
|
{
|
||||||
Q_ASSERT(window);
|
Q_ASSERT(window);
|
||||||
if (titleBarHeight > 0) {
|
if (titleBarHeight >= 0) {
|
||||||
// Reduce top frame to zero since we paint it ourselves. Use
|
// Reduce top frame to zero since we paint it ourselves. Use
|
||||||
// device pixel to avoid rounding errors.
|
// device pixel to avoid rounding errors.
|
||||||
const QMargins margins = {0, -titleBarHeight, 0, 0};
|
const QMargins margins = {0, -titleBarHeight, 0, 0};
|
||||||
|
@ -292,7 +292,10 @@ void FramelessHelper::removeWindowFrame(QObject *obj, const bool center)
|
||||||
// disabled.
|
// disabled.
|
||||||
widget->setMouseTracking(true);
|
widget->setMouseTracking(true);
|
||||||
widget->installEventFilter(this);
|
widget->installEventFilter(this);
|
||||||
updateQtFrame(widget->windowHandle(), m_titleBarHeight);
|
QWindow *window = widget->windowHandle();
|
||||||
|
if (window) {
|
||||||
|
updateQtFrame(window, m_titleBarHeight);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue