Skip to content

Instantly share code, notes, and snippets.

@Longhanks
Last active November 11, 2018 03:55
Show Gist options
  • Save Longhanks/e3be3207d5d584ed9eeecdef904d4ffa to your computer and use it in GitHub Desktop.
Save Longhanks/e3be3207d5d584ed9eeecdef904d4ffa to your computer and use it in GitHub Desktop.
fix_native_window
target_include_directories(<target> PRIVATE ${Qt5Gui_PRIVATE_INCLUDE_DIRS})
Q_DECLARE_METATYPE(QMargins)
#include <qpa/qplatformwindow.h>
#include <qpa/qplatformnativeinterface.h>
QVariant v = qVariantFromValue(QMargins{-8, -30, -8, -8});
native_window->windowHandle()->setProperty("_q_windowsCustomMargins", v);
QGuiApplication::platformNativeInterface()->setWindowProperty(
native_window->windowHandle()->handle(), QStringLiteral("WindowsCustomMargins"), v);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment