[Interest] Best Practices returning data from a dialog

Diego Iastrubni diegoiast at gmail.com
Thu Aug 23 07:50:42 CEST 2012


On Thu, Aug 23, 2012 at 3:17 AM, Charley Bay <charleyb123 at gmail.com> wrote:

> 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".
>
>
I usually "exec()" the dialog and then use a set of getData/setData()
methods (still using my TurboVision mentality... its been... 10-15 years
since I programmed in TV....). For modaless dialogs, I fire up a signal
when the "apply" button is pressed.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20120823/f09c6f2a/attachment.html>


More information about the Interest mailing list