Add "setGeometry" to delegate
| | |
| | | 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; |
| | | } |
| | | |
| | |
| | | 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: |
| | |
| | | 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(); |
| | | } |
| | |
| | | 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; |
| | | }; |
| | | |
| | |
| | | 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(); |
| | | } |
| | |
| | | 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; |
| | | }; |
| | | |