diff --git a/FramelessHelperConfig.cmake.in b/FramelessHelperConfig.cmake.in index e8f60c0c..2dd799d4 100644 --- a/FramelessHelperConfig.cmake.in +++ b/FramelessHelperConfig.cmake.in @@ -40,9 +40,6 @@ foreach(_component ${@PROJECT_NAME@_FIND_COMPONENTS}) if(EXISTS "${__targets_file}") include("${__targets_file}") add_library(${__target} ALIAS @PROJECT_NAME@::${__target_full}) - if(NOT "x${_component}" STREQUAL "xCore") - list(APPEND _@PROJECT_NAME@_available_components ${_component}) - endif() else() 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.") @@ -76,6 +73,7 @@ set_package_properties(@PROJECT_NAME@ PROPERTIES ) 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${QT_VERSION_MAJOR} REQUIRED COMPONENTS ${_@PROJECT_NAME@_available_components}) endif() diff --git a/src/quick/framelessquickhelper.cpp b/src/quick/framelessquickhelper.cpp index 0ca49b34..89f24daf 100644 --- a/src/quick/framelessquickhelper.cpp +++ b/src/quick/framelessquickhelper.cpp @@ -409,39 +409,44 @@ void FramelessQuickHelperPrivate::repaintAllChildren() void FramelessQuickHelperPrivate::doRepaintAllChildren() { - Q_Q(const FramelessQuickHelper); - QQuickWindow *window = q->window(); - if (!window) { - return; - } + 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); + // 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(); + // 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 items = window->findChildren(); - 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(); + const QList items = window->findChildren(); + 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(); + } } quint32 FramelessQuickHelperPrivate::readyWaitTime() const diff --git a/src/widgets/framelesswidgetshelper.cpp b/src/widgets/framelesswidgetshelper.cpp index e6866605..344055a0 100644 --- a/src/widgets/framelesswidgetshelper.cpp +++ b/src/widgets/framelesswidgetshelper.cpp @@ -374,15 +374,20 @@ void FramelessWidgetsHelperPrivate::repaintAllChildren() void FramelessWidgetsHelperPrivate::doRepaintAllChildren() { + repaintTimer.stop(); if (!window) { return; } - forceWidgetRepaint(window); - const QList widgets = window->findChildren(); - for (auto &&widget : std::as_const(widgets)) { - forceWidgetRepaint(widget); + static bool firstTime = true; + if (firstTime) { + firstTime = false; + } else { + forceWidgetRepaint(window); + const QList widgets = window->findChildren(); + for (auto &&widget : std::as_const(widgets)) { + forceWidgetRepaint(widget); + } } - repaintTimer.stop(); } quint32 FramelessWidgetsHelperPrivate::readyWaitTime() const