Sine Striker
2024-01-29 03605a234142933dc49f1a6b2fbf49ba007d87f8
Add "setGeometry" to delegate
6个文件已修改
13 ■■■■■ 已修改文件
src/core/contexts/abstractwindowcontext.cpp 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/core/windowitemdelegate_p.h 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/quick/quickitemdelegate.cpp 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/quick/quickitemdelegate_p.h 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/widgets/widgetitemdelegate.cpp 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/widgets/widgetitemdelegate_p.h 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/core/contexts/abstractwindowcontext.cpp
@@ -211,7 +211,7 @@
                int y = (screenGeometry.height() - windowGeometry.height()) / 2;
                QPoint pos(x, y);
                pos += screenGeometry.topLeft();
                m_windowHandle->setPosition(pos);
                m_delegate->setGeometry(m_host, QRect(pos, windowGeometry.size()));
                return;
            }
src/core/windowitemdelegate_p.h
@@ -49,6 +49,7 @@
        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 setGeometry(QObject *host, const QRect &rect) = 0;
        virtual void bringWindowToTop(QObject *host) const = 0;
    private:
src/quick/quickitemdelegate.cpp
@@ -80,6 +80,10 @@
        static_cast<QQuickWindow *>(host)->setVisible(visible);
    }
    void QuickItemDelegate::setGeometry(QObject *host, const QRect &rect) {
        static_cast<QQuickWindow *>(host)->setGeometry(rect);
    }
    void QuickItemDelegate::bringWindowToTop(QObject *host) const {
        static_cast<QQuickWindow *>(host)->raise();
    }
src/quick/quickitemdelegate_p.h
@@ -45,6 +45,7 @@
        void restoreCursorShape(QObject *host) const override;
        void setWindowFlags(QObject *host, Qt::WindowFlags flags) const override;
        void setWindowVisible(QObject *host, bool visible) const override;
        void setGeometry(QObject *host, const QRect &rect) override;
        void bringWindowToTop(QObject *host) const override;
    };
src/widgets/widgetitemdelegate.cpp
@@ -104,6 +104,10 @@
        static_cast<QWidget *>(host)->setVisible(visible);
    }
    void WidgetItemDelegate::setGeometry(QObject *host, const QRect &rect) {
        static_cast<QWidget *>(host)->setGeometry(rect);
    }
    void WidgetItemDelegate::bringWindowToTop(QObject *host) const {
        static_cast<QWidget *>(host)->raise();
    }
src/widgets/widgetitemdelegate_p.h
@@ -46,6 +46,7 @@
        void restoreCursorShape(QObject *host) const override;
        void setWindowFlags(QObject *host, Qt::WindowFlags flags) const override;
        void setWindowVisible(QObject *host, bool visible) const override;
        void setGeometry(QObject *host, const QRect &rect) override;
        void bringWindowToTop(QObject *host) const override;
    };