win: don't repaint superflus
This commit is contained in:
parent
3ed04dedeb
commit
aa489b25d0
|
@ -40,9 +40,6 @@ foreach(_component ${@PROJECT_NAME@_FIND_COMPONENTS})
|
||||||
if(EXISTS "${__targets_file}")
|
if(EXISTS "${__targets_file}")
|
||||||
include("${__targets_file}")
|
include("${__targets_file}")
|
||||||
add_library(${__target} ALIAS @PROJECT_NAME@::${__target_full})
|
add_library(${__target} ALIAS @PROJECT_NAME@::${__target_full})
|
||||||
if(NOT "x${_component}" STREQUAL "xCore")
|
|
||||||
list(APPEND _@PROJECT_NAME@_available_components ${_component})
|
|
||||||
endif()
|
|
||||||
else()
|
else()
|
||||||
set(@PROJECT_NAME@_FOUND FALSE)
|
set(@PROJECT_NAME@_FOUND FALSE)
|
||||||
set(@PROJECT_NAME@_NOT_FOUND_MESSAGE "Can't find necessary configuration file for ${__target}, please make sure this component is built successfully and installed properly.")
|
set(@PROJECT_NAME@_NOT_FOUND_MESSAGE "Can't find necessary configuration file for ${__target}, please make sure this component is built successfully and installed properly.")
|
||||||
|
@ -76,6 +73,7 @@ set_package_properties(@PROJECT_NAME@ PROPERTIES
|
||||||
)
|
)
|
||||||
|
|
||||||
if(${@PROJECT_NAME@_FOUND})
|
if(${@PROJECT_NAME@_FOUND})
|
||||||
|
list(REMOVE_DUPLICATES _@PROJECT_NAME@_available_components)
|
||||||
find_dependency(QT NAMES Qt6 Qt5 REQUIRED COMPONENTS ${_@PROJECT_NAME@_available_components})
|
find_dependency(QT NAMES Qt6 Qt5 REQUIRED COMPONENTS ${_@PROJECT_NAME@_available_components})
|
||||||
find_dependency(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS ${_@PROJECT_NAME@_available_components})
|
find_dependency(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS ${_@PROJECT_NAME@_available_components})
|
||||||
endif()
|
endif()
|
||||||
|
|
|
@ -409,39 +409,44 @@ void FramelessQuickHelperPrivate::repaintAllChildren()
|
||||||
|
|
||||||
void FramelessQuickHelperPrivate::doRepaintAllChildren()
|
void FramelessQuickHelperPrivate::doRepaintAllChildren()
|
||||||
{
|
{
|
||||||
Q_Q(const FramelessQuickHelper);
|
|
||||||
QQuickWindow *window = q->window();
|
|
||||||
if (!window) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
#ifdef Q_OS_WINDOWS
|
|
||||||
// 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.
|
|
||||||
if (!window->isVisible()) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (!((window->windowState() & (Qt::WindowMinimized | Qt::WindowMaximized | Qt::WindowFullScreen)) || q->isWindowFixedSize())) {
|
|
||||||
const QSize originalSize = window->size();
|
|
||||||
static constexpr const auto margins = QMargins{ 10, 10, 10, 10 };
|
|
||||||
window->resize(originalSize.shrunkBy(margins));
|
|
||||||
window->resize(originalSize.grownBy(margins));
|
|
||||||
window->resize(originalSize);
|
|
||||||
}
|
|
||||||
window->requestUpdate();
|
|
||||||
#if 0 // Calling QWindow::requestUpdate() should be enough.
|
|
||||||
const QList<QQuickItem *> items = window->findChildren<QQuickItem *>();
|
|
||||||
for (auto &&item : std::as_const(items)) {
|
|
||||||
// Only items with the "QQuickItem::ItemHasContents" flag enabled are allowed to call "update()".
|
|
||||||
// And don't repaint the item if it's hidden.
|
|
||||||
if ((item->flags() & QQuickItem::ItemHasContents) && item->isVisible()) {
|
|
||||||
item->update();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
repaintTimer.stop();
|
repaintTimer.stop();
|
||||||
|
static bool firstTime = true;
|
||||||
|
if (firstTime) {
|
||||||
|
firstTime = false;
|
||||||
|
} else {
|
||||||
|
Q_Q(const FramelessQuickHelper);
|
||||||
|
QQuickWindow *window = q->window();
|
||||||
|
if (!window) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
#ifdef Q_OS_WINDOWS
|
||||||
|
// 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.
|
||||||
|
if (!window->isVisible()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!((window->windowState() & (Qt::WindowMinimized | Qt::WindowMaximized | Qt::WindowFullScreen)) || q->isWindowFixedSize())) {
|
||||||
|
const QSize originalSize = window->size();
|
||||||
|
static constexpr const auto margins = QMargins{ 10, 10, 10, 10 };
|
||||||
|
window->resize(originalSize.shrunkBy(margins));
|
||||||
|
window->resize(originalSize.grownBy(margins));
|
||||||
|
window->resize(originalSize);
|
||||||
|
}
|
||||||
|
window->requestUpdate();
|
||||||
|
#if 0 // Calling QWindow::requestUpdate() should be enough.
|
||||||
|
const QList<QQuickItem *> items = window->findChildren<QQuickItem *>();
|
||||||
|
for (auto &&item : std::as_const(items)) {
|
||||||
|
// Only items with the "QQuickItem::ItemHasContents" flag enabled are allowed to call "update()".
|
||||||
|
// And don't repaint the item if it's hidden.
|
||||||
|
if ((item->flags() & QQuickItem::ItemHasContents) && item->isVisible()) {
|
||||||
|
item->update();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
quint32 FramelessQuickHelperPrivate::readyWaitTime() const
|
quint32 FramelessQuickHelperPrivate::readyWaitTime() const
|
||||||
|
|
|
@ -374,15 +374,20 @@ void FramelessWidgetsHelperPrivate::repaintAllChildren()
|
||||||
|
|
||||||
void FramelessWidgetsHelperPrivate::doRepaintAllChildren()
|
void FramelessWidgetsHelperPrivate::doRepaintAllChildren()
|
||||||
{
|
{
|
||||||
|
repaintTimer.stop();
|
||||||
if (!window) {
|
if (!window) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
forceWidgetRepaint(window);
|
static bool firstTime = true;
|
||||||
const QList<QWidget *> widgets = window->findChildren<QWidget *>();
|
if (firstTime) {
|
||||||
for (auto &&widget : std::as_const(widgets)) {
|
firstTime = false;
|
||||||
forceWidgetRepaint(widget);
|
} else {
|
||||||
|
forceWidgetRepaint(window);
|
||||||
|
const QList<QWidget *> widgets = window->findChildren<QWidget *>();
|
||||||
|
for (auto &&widget : std::as_const(widgets)) {
|
||||||
|
forceWidgetRepaint(widget);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
repaintTimer.stop();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
quint32 FramelessWidgetsHelperPrivate::readyWaitTime() const
|
quint32 FramelessWidgetsHelperPrivate::readyWaitTime() const
|
||||||
|
|
Loading…
Reference in New Issue