From 2d2fc799bc698ebf7e7c8bcc394366d0d7bf071b Mon Sep 17 00:00:00 2001
From: Sine Striker <trueful@163.com>
Date: 周二, 20 2月 2024 18:18:39 +0800
Subject: [PATCH] Partially finish the bug after window close and reshow

---
 src/widgets/widgetitemdelegate.cpp |   24 +++++++++++++++++-------
 1 files changed, 17 insertions(+), 7 deletions(-)

diff --git a/src/widgets/widgetitemdelegate.cpp b/src/widgets/widgetitemdelegate.cpp
index 07c8aa3..e1ff752 100644
--- a/src/widgets/widgetitemdelegate.cpp
+++ b/src/widgets/widgetitemdelegate.cpp
@@ -1,10 +1,14 @@
+// Copyright (C) 2023-2024 Stdware Collections (https://www.github.com/stdware)
+// Copyright (C) 2021-2023 wangwenx190 (Yuhang Zhao)
+// SPDX-License-Identifier: Apache-2.0
+
 #include "widgetitemdelegate_p.h"
 
 #include <QtGui/QMouseEvent>
 #include <QtWidgets/QWidget>
 #include <QtWidgets/QApplication>
 
-extern Q_WIDGETS_EXPORT QWidget *qt_button_down;
+extern Q_DECL_IMPORT QWidget *qt_button_down;
 
 namespace QWK {
 
@@ -45,12 +49,6 @@
         const QSize minSize = widget->minimumSize();
         const QSize maxSize = widget->maximumSize();
         if (!minSize.isEmpty() && !maxSize.isEmpty() && (minSize == maxSize)) {
-            return true;
-        }
-        // Usually set by the user.
-        const QSizePolicy sizePolicy = widget->sizePolicy();
-        if ((sizePolicy.horizontalPolicy() == QSizePolicy::Fixed) &&
-            (sizePolicy.verticalPolicy() == QSizePolicy::Fixed)) {
             return true;
         }
         return false;
@@ -94,10 +92,22 @@
         return static_cast<const QWidget *>(host)->windowFlags();
     }
 
+    QRect WidgetItemDelegate::getGeometry(const QObject *host) const {
+        return static_cast<const QWidget *>(host)->geometry();
+    }
+
     void WidgetItemDelegate::setWindowFlags(QObject *host, Qt::WindowFlags flags) const {
         static_cast<QWidget *>(host)->setWindowFlags(flags);
     }
 
+    void WidgetItemDelegate::setWindowVisible(QObject *host, bool visible) const {
+        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();
     }

--
Gitblit v1.9.1