diff --git a/utilities.cpp b/utilities.cpp index 628d1d1..5b40388 100644 --- a/utilities.cpp +++ b/utilities.cpp @@ -32,6 +32,8 @@ /* * Copied from https://code.qt.io/cgit/qt/qtbase.git/tree/src/widgets/effects/qpixmapfilter.cpp * With minor modifications, most of them are format changes. + * They are exported functions of Qt, we can make use of them directly, but they are in the QtWidgets + * module, I don't want our library have such a dependency. */ #ifndef AVG @@ -328,6 +330,8 @@ void Utilities::blurImage(QImage &blurImage, const qreal radius, const bool qual /* * Copied from https://code.qt.io/cgit/qt/qtbase.git/tree/src/widgets/styles/qstyle.cpp * With minor modifications, most of them are format changes. + * They are exported functions of Qt, we can make use of them directly, but they are in the QtWidgets + * module, I don't want our library have such a dependency. */ static inline Qt::Alignment visualAlignment(const Qt::LayoutDirection direction, const Qt::Alignment alignment) diff --git a/utilities_win32.cpp b/utilities_win32.cpp index 78e64bb..12e9ae9 100644 --- a/utilities_win32.cpp +++ b/utilities_win32.cpp @@ -809,7 +809,9 @@ void Utilities::updateQtFrameMargins(QWindow *window, const bool enable) return; } const int tbh = enable ? Utilities::getSystemMetric(window, Utilities::SystemMetric::TitleBarHeight, true, true) : 0; - const QMargins margins = {0, -tbh, 0, 0}; + const int bw = enable ? Utilities::getSystemMetric(window, Utilities::SystemMetric::BorderWidth, true, true) : 0; + const int bh = enable ? Utilities::getSystemMetric(window, Utilities::SystemMetric::BorderHeight, true, true) : 0; + const QMargins margins = {-bw, -tbh, -bw, -bh}; // left, top, right, bottom const QVariant marginsVar = QVariant::fromValue(margins); window->setProperty("_q_windowsCustomMargins", marginsVar); #if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))