Center exportDialog using screen geometry#2930
Conversation
|
Thanks for the PR, I'm not convinced we want that dialog in the center of the screen as a default, but this PR does address an existing issue and thus is an improvement, so I'm going to merge. I need to pay more attention to what other applications do in this regard. |
|
Hi @j9ac9k The other options I can think of:
All have their issues:
I would lean towards using the active window (can be easily accessed from QApplication) and checking that there is sufficient room for the dialog to not overflow and if not either moving so that it doesn't overflow or defaulting back to the center of the screen. A little complex perhaps, but should cover most use cases and still keep the dialog close to the graph. If you've got any other ideas, let me know and I can try to implement them. |
|
I may have merged pre-emptively. Using PyQt6 6.6.1, with the export dialog... |
|
Ahh, QDesktopWidget is deprecated, and was removed in Qt6 https://doc.qt.io/qt-6/widgets-changes-qt6.html#qdesktopwidget-and-qapplication-desktop |
|
Able to work around it with: # screen = QtWidgets.QApplication.desktop().screenNumber(QtWidgets.QApplication.desktop().cursor().pos())
# centre = QtWidgets.QDesktopWidget().availableGeometry(self.screen()).center()
center = self.screen().availableGeometry().center()
frame = self.frameGeometry()
frame.moveCenter(center) |
The fix for Issue 2510 #2510 can result in the y coordinate being 0. See attached image where application is not full screen and exportDialog appears at the top of the screen
This fixes that by using the screen geometry to find the center of the screen and then centers the exportDialog to the center of the active screen.
Fixes #2510