Sine Striker
2023-12-19 2ccafcb1d891ed0fff4cc85729ca1faf5b7f1c96
src/widgets/widgetitemdelegate.cpp
@@ -12,7 +12,7 @@
    WidgetItemDelegate::~WidgetItemDelegate() = default;
    QWindow *WidgetItemDelegate::window(QObject *obj) const {
    QWindow *WidgetItemDelegate::window(const QObject *obj) const {
        return static_cast<const QWidget *>(obj)->windowHandle();
    }
@@ -31,7 +31,7 @@
        return {originPoint, size};
    }
    QWindow *WidgetItemDelegate::hostWindow(QObject *host) const {
    QWindow *WidgetItemDelegate::hostWindow(const QObject *host) const {
        return static_cast<const QWidget *>(host)->windowHandle();
    }
@@ -60,7 +60,8 @@
        return static_cast<const QWidget *>(host)->isActiveWindow();
    }
    void WidgetItemDelegate::resetQtGrabbedControl() const {
    void WidgetItemDelegate::resetQtGrabbedControl(QObject *host) const {
        Q_UNUSED(host);
        if (!qt_button_down) {
            return;
        }
@@ -69,8 +70,32 @@
        const auto event = new QMouseEvent(
            QEvent::MouseButtonRelease, invalidPos, invalidPos, invalidPos, Qt::LeftButton,
            QGuiApplication::mouseButtons() ^ Qt::LeftButton, QGuiApplication::keyboardModifiers());
        QApplication::postEvent(qt_button_down, event);
        QCoreApplication::postEvent(qt_button_down, event);
        qt_button_down = nullptr;
    }
    Qt::WindowStates WidgetItemDelegate::getWindowState(const QObject *host) const {
        return static_cast<const QWidget *>(host)->windowState();
    }
    void WidgetItemDelegate::setWindowState(QObject *host, Qt::WindowStates state) const {
        static_cast<QWidget *>(host)->setWindowState(state);
    }
    void WidgetItemDelegate::setCursorShape(QObject *host, Qt::CursorShape shape) const {
        static_cast<QWidget *>(host)->setCursor(QCursor(shape));
    }
    void WidgetItemDelegate::restoreCursorShape(QObject *host) const {
        static_cast<QWidget *>(host)->unsetCursor();
    }
    Qt::WindowFlags WidgetItemDelegate::getWindowFlags(const QObject *host) const {
        return static_cast<const QWidget *>(host)->windowFlags();
    }
    void WidgetItemDelegate::setWindowFlags(QObject *host, Qt::WindowFlags flags) const {
        static_cast<QWidget *>(host)->setWindowFlags(flags);
    }
}