Closed HannesLum closed 2 years ago
Sorry to see this problem so late. If you want fixed size dialog, There are three ways
Qt.MSWindowsFixedSizeDialogHint
setMinimumSize
and setMaximumSize
dialog.setFixedSize
Try them again, the crash problem, I will debug it later
left: 1920x1080 100% right: 1920x1080 125%
Slowly drag the window between the two screens
I think this Qt's or windows bug is caused by using 'MSWindowsFixedSizeDialogHint' and 'setFixedSize' of the top-level layout at the same time.
because remove MSWindowsFixedSizeDialogHint
, use os.environ['QT_SCALE_FACTOR'] = '1.0'
or a.setAttribute(Qt.AA_EnableHighDpiScaling, False)
, the problem is still exist.
Oh, so it is a Qt or windows bug after all. Thank you for the help!
When the flag
Qt.MSWindowsFixedSizeDialogHint
is set, the widget crashes, when it is dragged from one monitor to another. Here is a minimal example that creates this behaviour and the following is a closer explanation of the behaviour:When dragging certain widgets across two monitors of different sizes, they get resized automatically, as any other window, but the widgets then the widgets enter an infinite resizing loop and become unresponsive until python crashes. In order to reproduce this issue, the hardest part might be that you need two incompatible screens. Both of my screens have a resolution of 1920x1080 but their size in inches/cm is different. I'm not sure how my Windows 10 OS handles this exactly, but all windows are resized when dragged from one screen to another, so that for example text has a readable size. Trying this with the minimal example, will result in a freezing of the QDialog widget.
To be more exact my left monitor is the smaller one. This might be important because the window size is determined by the center point of the window, and i think for certain widgets they don't resize around the center point, but are a little left-bound. I believe it has something to do with the resizing of the widget text changing the width of the widget, because a common trait of the affected widgets where i found this issue are texts spanning until the left border of their hBox or vBox, but i can't know for sure, as there are also widgets with stranger behaviour.
Environment
QApplication.style().metaObject().className()
: "QWindowsVistaStyle"