[Qt-interest] adressing something to the mainWindow from a dialog
Usman Ajmal
uzmanajmal at gmail.com
Tue Apr 7 10:24:36 CEST 2009
PHD or PhD or Ph.D?
:)
No offense. Just a joke.
On Tue, Apr 7, 2009 at 1:13 PM, Giancarlo Amati
<ilferraresebono at hotmail.it>wrote:
> I'm afraid u didn't understand the question...probably my fault.
> QT as well as MFC they have they're own scoping for the variable through
> the application due to different mechanism
> Moreover, having more than 10 years experience in C++ programming with a
> Computer Science degree and PHD I appreciate your effort in reminding me the
> basic rules of C++ (of course my question wasn't on that).
> Basically the question was if I have a class of mine derived from any of QT
> class I can always have the access to a pointer which points to the main
> windows/application as in MFC there is this mechanism while it doesn't
> exists expicitly in QT....
>
> Best Regards.
> Giancarlo Amati
>
> > From: alex at wai.com
> > To: qt-interest at trolltech.com
> > Date: Mon, 6 Apr 2009 16:05:28 -0700
> > Subject: Re: [Qt-interest] adressing something to the mainWindow from a
> dialog
> >
> > Please take into the count that correctly asked question is at least half
> of a right answer. And I afraid I might not understand it right.
> >
> >
> > So asssume you have vaiable 'var' in your MainWindow class.
> >
> > class MainWindow
> > {
> > ...........
> > int var;
> > ...........
> > }
> >
> > Remember that variable 'var' makes sence only withing MainWindow object.
> > Even you have only one object, you should have allocate it somewhere,
> probably like this:
> >
> > MainWindow* mainWindow = new ........;
> >
> > So first thing you need is a pointer to your mainWindow object.
> > How you get it, depends on the code, here I would assume that you can
> access it, by storing the pointer in a global variable. (I don't recommend
> this way, it is just chosen for simplicity).
> >
> >
> > Once you have an access to a pointer to MainWindow object in your module
> (a dialog window):
> >
> > - if var variable is public, you can get and set it directly, like
> mainWindow->var = 3; int mainWindow->var = 4;
> > - if it is protected or private, you can either add public methods
> (functions) to MainWindow which will return or set value of val, etc.
> >
> >
> > Now I hope this helps.
> > But I would ask you to remember that QT interest forum is not a place for
> basic C++ questions.
> > The reason is that most of people read and post here in their free time.
> > And they don't like to dig through non-qt related questions all the time,
> because they were currently interested in specific product, even they were
> willing to help you.
> > There are special forums for C++ beginners. Try to find one. You might
> find much more help there too.
> >
> > Best regards,
> > Alex
> >
> >
> > ________________________________________
> > From: qt-interest-bounces at trolltech.com [mailto:
> qt-interest-bounces at trolltech.com] On Behalf Of Giancarlo Amati
> > Sent: Monday, April 06, 2009 9:17 AM
> > To: qt-interest at trolltech.com
> > Subject: [Qt-interest] adressing something to the mainWindow from a
> dialog
> >
> > Hello everybody,
> >
> > i have this problem, I have a dialog windows from where I want to adress
> a variable which beloges to may MainWindow class linked to the main
> application. Is there a way to do it?
> >
> > Kind regards.
> > Giancarlo
> > ________________________________________
> > Scegli fra più di 30 stazioni! Ascolta la radio su Messenger
> >
> >
> >
> ---------------------------------------------------------------------------------------------------
> > Weidlinger Associates, Inc. made the following annotations.
> >
> > "This message and any attachments are solely for the intended recipient
> and may contain confidential or privileged information. If you are not the
> intended recipient, any disclosure, copying, use, or distribution of the
> information included in this message and any attachments is prohibited. If
> you have received this communication in error, please notify us by reply
> e-mail and immediately and permanently delete this message and any
> attachments. Thank you."
> >
> > "Please consider our environment before printing this email."
> >
> > _______________________________________________
> > Qt-interest mailing list
> > Qt-interest at trolltech.com
> > http://lists.trolltech.com/mailman/listinfo/qt-interest
>
> ------------------------------
> Dillo con le Emoticon! Scarica il nuovo Messenger 2009<http://clk.atdmt.com/GBL/go/140630363/direct/01/>
>
> _______________________________________________
> Qt-interest mailing list
> Qt-interest at trolltech.com
> http://lists.trolltech.com/mailman/listinfo/qt-interest
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20090407/a7a894b5/attachment.html
More information about the Qt-interest-old
mailing list