diff --git a/examples/common.pri b/examples/common.pri index 22af8d2..4b9cb29 100644 --- a/examples/common.pri +++ b/examples/common.pri @@ -4,6 +4,7 @@ DEFINES += \ QT_NO_CAST_FROM_ASCII \ QT_NO_CAST_TO_ASCII \ FRAMELESSHELPER_STATIC +RESOURCES += $$PWD/resources.qrc HEADERS += \ $$PWD/../framelesshelper_global.h \ $$PWD/../framelesswindowsmanager.h @@ -18,7 +19,6 @@ win32 { DEFINES += WNEF_LINK_SYSLIB LIBS += -luser32 -lgdi32 -ldwmapi -lshcore -ld2d1 } - RESOURCES += $$PWD/windows.qrc RC_FILE = $$PWD/windows.rc OTHER_FILES += $$PWD/windows.manifest } else { diff --git a/examples/windows.qrc b/examples/resources.qrc similarity index 100% rename from examples/windows.qrc rename to examples/resources.qrc diff --git a/framelesshelper.cpp b/framelesshelper.cpp index 3b6ada0..f9de5c9 100644 --- a/framelesshelper.cpp +++ b/framelesshelper.cpp @@ -81,7 +81,7 @@ FramelessHelper::FramelessHelper(QObject *parent) : QObject(parent) {} void FramelessHelper::updateQtFrame(QWindow *window, const int titleBarHeight) { Q_ASSERT(window); - if (titleBarHeight > 0) { + if (titleBarHeight >= 0) { // Reduce top frame to zero since we paint it ourselves. Use // device pixel to avoid rounding errors. const QMargins margins = {0, -titleBarHeight, 0, 0}; @@ -292,7 +292,10 @@ void FramelessHelper::removeWindowFrame(QObject *obj, const bool center) // disabled. widget->setMouseTracking(true); widget->installEventFilter(this); - updateQtFrame(widget->windowHandle(), m_titleBarHeight); + QWindow *window = widget->windowHandle(); + if (window) { + updateQtFrame(window, m_titleBarHeight); + } } } #endif