From dbab994b2cdc5469cf53e3f6c5d09bc2d7b39ce9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thorbj=C3=B8rn=20Lund=20Martsum?= Date: Wed, 7 Mar 2012 16:02:47 +0100 Subject: [PATCH] QDialog - Change exec() and open() to virtual functions QDialog is meant for inheritance (it contains other virtual functions) ... The main reason for this is that we inside the dialog could have a (datadepened) precondition that should prevent the dialog from being shown at all - instead we might just want to show a messagebox. That is not easy solvable in Qt right now. It is possible to reimplement setVisible - but calling reject from setVisible does not work. There seems only to be clumsy solutions to that problem - unless these functions are made virtual Beside it also creates a nice symmetry to done. Change-Id: I51c29e1f7a4a5522f5c0f71bcf98c943580790b9 Reviewed-by: Friedemann Kleint Reviewed-by: Andreas Aardal Hanssen Reviewed-by: Robin Burchell --- src/widgets/dialogs/qdialog.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/widgets/dialogs/qdialog.h b/src/widgets/dialogs/qdialog.h index 7d3052a782..f20ff46d41 100644 --- a/src/widgets/dialogs/qdialog.h +++ b/src/widgets/dialogs/qdialog.h @@ -91,8 +91,8 @@ Q_SIGNALS: void rejected(); public Q_SLOTS: - void open(); - int exec(); + virtual void open(); + virtual int exec(); virtual void done(int); virtual void accept(); virtual void reject();