Each of the touched dialogs can use extra space. Remember user's resizing and moving of a dialog, because its customized size is likely to be preferable to the default size the next time the dialog is shown.
The added utility can be easily applied to other dialogs if needed.
KWindowConfig::saveWindowSize() in place of
QWidget::saveGeometry(), because the former takes a
QWindow* QWidget::windowHandle() returns
nullptr for each dialog
affected by this commit.
Connect saving geometry to
QDialog::finished rather than
QObject::destroyed signal to be on the safe side. Besides the finished
signal, the added utility
QWidget API. Connecting to
QObject::destroyed signal instead would
make the utility applicable to non-dialog widgets and therefore more
universal. However, connecting to the destroyed signal only happens to
work in Qt 5 because widget objects emit this signal in
~QObject(). Relying on this only indirectly documented Qt
behavior is too risky for my liking. Besides, top-level widgets that do
not inherit from
QDialog might return non-null from
QWidget::windowHandle(), and so use
Another downside of connecting saving geometry to
that this signal is not emitted in some circumstances. Quote from the
Note that this signal is not emitted when hiding the dialog with
setVisible(false). This includes deleting the dialog while it is visible.
Fortunately, the finished signal is normally emitted in practice. All
the affected dialogs, except for VCS History, are shown via
which makes them modal. Therefore, currently the only way to exit
KDevelop normally while not saving a dialog's geometry is to open the
VCS History dialog and quit KDevelop without closing the dialog first.
This downside is unfortunate, but I don't know how to safely eliminate
it without significantly complicating usage of the added utility by
requiring the dialogs to invoke saving geometry from their destructors.