diff --git a/framelesshelper_windows.pro b/framelesshelper_windows.pro index 3f920e7..8557871 100644 --- a/framelesshelper_windows.pro +++ b/framelesshelper_windows.pro @@ -17,7 +17,7 @@ DEFINES += \ FRAMELESSHELPER_STATIC LINK_TO_SYSTEM_DLL { DEFINES += WNEF_LINK_SYSLIB - LIBS += -luser32 -lgdi32 -ldwmapi -lshcore + LIBS += -luser32 -lgdi32 -ldwmapi -lshcore -ld2d1 } CONFIG -= embed_manifest_exe RC_FILE = framelesshelper_windows.rc diff --git a/winnativeeventfilter.cpp b/winnativeeventfilter.cpp index 623e2b7..799050c 100644 --- a/winnativeeventfilter.cpp +++ b/winnativeeventfilter.cpp @@ -113,7 +113,7 @@ Q_DECLARE_METATYPE(QMargins) #else #define WNEF_RESOLVE_ERROR(funcName) \ if (!m_lp##funcName) { \ - qCritical().noquote() << "Failed to resolve symbol" << #funcName; \ + qFatal("Failed to resolve symbol" #funcName); \ } #endif #endif @@ -944,13 +944,17 @@ HWND getHWNDFromQObject(QObject *object) { Q_ASSERT(object); WId wid = 0; + if (object->isWindowType()) { + wid = qobject_cast(object)->winId(); + } #ifdef QT_WIDGETS_LIB - if (object->isWidgetType()) { + else if (object->isWidgetType()) { wid = qobject_cast(object)->winId(); } #endif - if (object->isWindowType()) { - wid = qobject_cast(object)->winId(); + else { + qFatal( + "Can't acquire the window handle: only top level QWidgets and QWindows are accepted."); } return reinterpret_cast(wid); }