[Interest] Best Practices returning data from a dialog

Charley Bay charleyb123 at gmail.com
Thu Aug 23 02:17:34 CEST 2012


JM spaketh:

> Hi all,
>
> What are the best practices to return from a common dialog window?
> At the moment I have already solved with a Slot connected to the closure
> of the dialog,
> that invokes methods to retreive data. But what are the best practices?
> What are the pros and cons of every solution?
>

Yes, there are several ways to do this.  IMHO it breaks out into two
patterns:

(a) Dialog operates on (references-to) *real* data, changes in the dialog
cause immediate change on the system, the dialog can later be closed.

(b) Dialog operates on a *copy* of the data-to-be edited, may have an
"apply" button to "push" changes to the system, but "cancel" means all
changes in the dialog are "un-done".

For (b) (which is most of my dialogs), IMHO it's easiest to explicitly
extract data from dialog-data-members after you confirmed the user "closed"
and did not "cancel".

So no, I don't ever "hook-up" slots-to-dialog-close operations as you did.

--charley
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20120822/f5a5f57a/attachment.html>


More information about the Interest mailing list