zhiyiYo / PyQt-Fluent-Widgets

A fluent design widgets library based on C++ Qt/PyQt/PySide. Make Qt Great Again.
https://qfluentwidgets.com
GNU General Public License v3.0
5.49k stars 523 forks source link

[Bug]: MessageBoxBase 无法在缺少父组件的情况下运行 #894

Closed Zhikun0201 closed 3 months ago

Zhikun0201 commented 3 months ago

What happened?

Traceback (most recent call last): File "D:\Projects\NarratinPySide\scripts\widgets\dialog_dialog.py", line 22, in dialog = Dialog() ^^^^^^^^ File "D:\Projects\NarratinPySide\scripts\widgets\dialog_dialog.py", line 6, in init super(Dialog, self).init(parent) File "D:\Projects\NarratinPySide\venv\Lib\site-packages\qfluentwidgets\components\dialog_box\message_box_base.py", line 19, in init super().init(parent=parent) File "D:\Projects\NarratinPySide\venv\Lib\site-packages\qfluentwidgets\components\dialog_box\mask_dialog_base.py", line 22, in init self.setGeometry(0, 0, parent.width(), parent.height()) ^^^^^^^^^^^^ AttributeError: 'NoneType' object has no attribute 'width'

Operation System

Windows 11 23H2

Python Version

3.12

PyQt/PySide Version

PySide6 6.7.1

PyQt/PySide-Fluent-Widgets Version

v1.5.7

How to Reproduce?

运行Code

Minimum code

if __name__ == '__main__':
    from PySide6.QtWidgets import QApplication
    import sys

    app = QApplication(sys.argv)
    dialog = MessageBoxBase()
    dialog.show()
    sys.exit(app.exec_())
zhiyiYo commented 3 months ago

必须有父级