[Qt-interest] how to access the Member Variable of MainWindowfrom another class?
Witteveen, Arnt
ArntW at enfocus.com
Wed Apr 13 17:07:42 CEST 2011
> Konstantin Tokarev:
>
> 12.04.2011, 13:43, "Muthulingam Ammaiappan" <muthulingam.a at gmail.com>:
> > Hi Friends,
> >
> > i am facing the following problem...
> >
> > how i can access the variable which is declared in the mainwindow
> > class from some other class constructor?
>
> It's generic C++ question which has nothing to do with Qt.
> You just need to have pointer or reference to MainWindow object to
> access it's public members inside your constructor (i.e., pass it as
> constructor parameter)
Or he can get the Q(Core)Application instance using the instance()
function of Q(Core)Application
http://doc.trolltech.com/latest/qcoreapplication.html#instance , it's a
singleton.
Arnt
More information about the Qt-interest-old
mailing list