Fix window visibility inconsistency
| | |
| | | } |
| | | |
| | | case RaiseWindowHook: { |
| | | if (!m_windowHandle) |
| | | return; |
| | | |
| | | m_delegate->setWindowVisible(m_host, true); |
| | | Qt::WindowStates state = m_delegate->getWindowState(m_host); |
| | | if (state & Qt::WindowMinimized) { |
| | | m_delegate->setWindowState(m_host, state & ~Qt::WindowMinimized); |
| | |
| | | case RaiseWindowHook: { |
| | | if (!windowId) |
| | | return; |
| | | m_delegate->setWindowVisible(m_host, true); |
| | | const auto hwnd = reinterpret_cast<HWND>(windowId); |
| | | bringWindowToFront(hwnd); |
| | | return; |
| | |
| | | virtual void setCursorShape(QObject *host, Qt::CursorShape shape) const = 0; |
| | | virtual void restoreCursorShape(QObject *host) const = 0; |
| | | virtual void setWindowFlags(QObject *host, Qt::WindowFlags flags) const = 0; |
| | | virtual void setWindowVisible(QObject *host, bool visible) const = 0; |
| | | virtual void bringWindowToTop(QObject *host) const = 0; |
| | | |
| | | private: |
| | |
| | | static_cast<QQuickWindow *>(host)->setFlags(flags); |
| | | } |
| | | |
| | | void QuickItemDelegate::setWindowVisible(QObject *host, bool visible) const { |
| | | static_cast<QQuickWindow *>(host)->setVisible(visible); |
| | | } |
| | | |
| | | void QuickItemDelegate::bringWindowToTop(QObject *host) const { |
| | | static_cast<QQuickWindow *>(host)->raise(); |
| | | } |
| | |
| | | void setCursorShape(QObject *host, Qt::CursorShape shape) const override; |
| | | void restoreCursorShape(QObject *host) const override; |
| | | void setWindowFlags(QObject *host, Qt::WindowFlags flags) const override; |
| | | void setWindowVisible(QObject *host, bool visible) const override; |
| | | void bringWindowToTop(QObject *host) const override; |
| | | }; |
| | | |
| | |
| | | static_cast<QWidget *>(host)->setWindowFlags(flags); |
| | | } |
| | | |
| | | void WidgetItemDelegate::setWindowVisible(QObject *host, bool visible) const { |
| | | static_cast<QWidget *>(host)->setVisible(visible); |
| | | } |
| | | |
| | | void WidgetItemDelegate::bringWindowToTop(QObject *host) const { |
| | | static_cast<QWidget *>(host)->raise(); |
| | | } |
| | |
| | | void setCursorShape(QObject *host, Qt::CursorShape shape) const override; |
| | | void restoreCursorShape(QObject *host) const override; |
| | | void setWindowFlags(QObject *host, Qt::WindowFlags flags) const override; |
| | | void setWindowVisible(QObject *host, bool visible) const override; |
| | | void bringWindowToTop(QObject *host) const override; |
| | | }; |
| | | |
| | |
| | | ctx->setWindowAttribute(QStringLiteral("extra-margins"), defaultMargins); |
| | | |
| | | // Enable dark mode by default, otherwise the frame borders are white |
| | | // ctx->setWindowAttribute(QStringLiteral("dark-mode"), true); |
| | | ctx->setWindowAttribute(QStringLiteral("dark-mode"), true); |
| | | |
| | | ctx->installNativeEventFilter(this); |
| | | ctx->installSharedEventFilter(this); |