[Qt-interest] Qt-interest Digest, Vol 12, Issue 13
Ross Driedger
ross at earz.ca
Mon Nov 2 23:36:20 CET 2009
On Mon, 02 Nov 2009 16:44:41 -0500, <qt-interest-request at trolltech.com>
wrote:
> Message: 2
> Date: Mon, 2 Nov 2009 22:49:55 +0200
> From: Mystical Groovy <mysticalgr at gmail.com>
> Subject: [Qt-interest] declaring QString globally
> To: qt-interest at trolltech.com
> Message-ID:
> <4877b36e0911021249m3285102bsb7069efdfa29a439 at mail.gmail.com>
> Content-Type: text/plain; charset="iso-8859-1"
> hello all,
> I have a question
> I have 3different classes on my app,
> lets say
> mainclass.cpp/h, preferencesdialog.cpp/h, checkrepo.cpp/h
> mainclass contains the main GUI where theres a slot that calls a
> Preferences
> Dialog from preferencesdialog class, now in the Preferences dialog the
> user
> add a string into a box, the user-input text is save on "repoText"
> QString,
> how can i use "repoText" qstring into checkrepo class?
> for example, checkrepo class is activated via mainclass GUI and theres a
> messagebox that shows "repoText" to the user. where "repoText" is
> declared
> into preferencesdialog class.
> I hope you understand what im asking, oh and btw, sry for my english
Ideally, you want to design your applications in such a way that the
application data is stored in a class separate from the classes that
display that data. So you might want to consider a redesign where this
value is stored in a class named, say, "PreferenceData", update that
string as the user changes the data and is accessed by a "CheckRepo"
object when it is required.
The temptation, when writing a 'simple program' to s scatter the
application data in the code ("make it quick -- hack it together"), but as
soon as the program grows, as all 'simple programs' seem to do, this
approach becomes totally unworkable.
--
"It was pretty good. Even the music was nice."
Yogi Berra, after attending an opera
Ross Driedger
ross at earz.ca
More information about the Qt-interest-old
mailing list