Skip to content
This repository has been archived by the owner on Dec 19, 2023. It is now read-only.

Commit

Permalink
win: minor fix
Browse files Browse the repository at this point in the history
  • Loading branch information
wangwenx190 committed Oct 19, 2023
1 parent aa489b2 commit 2cb8ec0
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ class FRAMELESSHELPER_QUICK_API FramelessQuickHelperPrivate : public QObject
bool qpaReady = false;
quint32 qpaWaitTime = 0;
QTimer repaintTimer{};
bool repaintedOnce = false;
};

FRAMELESSHELPER_END_NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ class FRAMELESSHELPER_WIDGETS_API FramelessWidgetsHelperPrivate : public QObject
QSizePolicy savedSizePolicy = {};
quint32 qpaWaitTime = 0;
QTimer repaintTimer{};
bool repaintedOnce = false;
};

FRAMELESSHELPER_END_NAMESPACE
11 changes: 5 additions & 6 deletions src/quick/framelessquickhelper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -410,10 +410,7 @@ void FramelessQuickHelperPrivate::repaintAllChildren()
void FramelessQuickHelperPrivate::doRepaintAllChildren()
{
repaintTimer.stop();
static bool firstTime = true;
if (firstTime) {
firstTime = false;
} else {
if (repaintedOnce) {
Q_Q(const FramelessQuickHelper);
QQuickWindow *window = q->window();
if (!window) {
Expand All @@ -423,8 +420,8 @@ void FramelessQuickHelperPrivate::doRepaintAllChildren()
// Sync the internal window frame margins with the latest DPI, otherwise
// we will get wrong window sizes after the DPI change.
std::ignore = Utils::updateInternalWindowFrameMargins(window, true);
#endif // Q_OS_WINDOWS
// No need to repaint the window when it's hidden.
#endif // Q_OS_WINDOWS \
// No need to repaint the window when it's hidden.
if (!window->isVisible()) {
return;
}
Expand All @@ -446,6 +443,8 @@ void FramelessQuickHelperPrivate::doRepaintAllChildren()
}
}
#endif
} else {
repaintedOnce = true;
}
}

Expand Down
13 changes: 6 additions & 7 deletions src/widgets/framelesswidgetshelper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -375,18 +375,17 @@ void FramelessWidgetsHelperPrivate::repaintAllChildren()
void FramelessWidgetsHelperPrivate::doRepaintAllChildren()
{
repaintTimer.stop();
if (!window) {
return;
}
static bool firstTime = true;
if (firstTime) {
firstTime = false;
} else {
if (repaintedOnce) {
if (!window) {
return;
}
forceWidgetRepaint(window);
const QList<QWidget *> widgets = window->findChildren<QWidget *>();
for (auto &&widget : std::as_const(widgets)) {
forceWidgetRepaint(widget);
}
} else {
repaintedOnce = true;
}
}

Expand Down

0 comments on commit 2cb8ec0

Please sign in to comment.