Minor tweaks

Signed-off-by: Yuhang Zhao <2546789017@qq.com>
This commit is contained in:
Yuhang Zhao 2021-03-26 09:27:43 +08:00
parent 4cba3a4dd4
commit d4a5239d26
2 changed files with 7 additions and 1 deletions

View File

@ -32,6 +32,8 @@
/* /*
* Copied from https://code.qt.io/cgit/qt/qtbase.git/tree/src/widgets/effects/qpixmapfilter.cpp * 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. * 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 #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 * 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. * 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) static inline Qt::Alignment visualAlignment(const Qt::LayoutDirection direction, const Qt::Alignment alignment)

View File

@ -809,7 +809,9 @@ void Utilities::updateQtFrameMargins(QWindow *window, const bool enable)
return; return;
} }
const int tbh = enable ? Utilities::getSystemMetric(window, Utilities::SystemMetric::TitleBarHeight, true, true) : 0; 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); const QVariant marginsVar = QVariant::fromValue(margins);
window->setProperty("_q_windowsCustomMargins", marginsVar); window->setProperty("_q_windowsCustomMargins", marginsVar);
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0)) #if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))