how to access the Member Variable of MainWindow from another class?
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?
code snippet:
Code:
{
Q_OBJECT
public:
~MainWindow();
public:
QList<int> cno_airfoilgeom;
QList<int> sno_airfoilgeom;
};
class AirfoilGeomTab
: public QWidget{
Q_OBJECT
public:
AirfoilGeomTab
(QWidget *parent
= 0);
};
i wanted to use the "cno_airfoilgeom" variable in the "AirfoilGeomTab" constructor...
AirfoilGeomTab::AirfoilGeomTab(QWidget *parent
) {
// i wanted to use the "cno_airfoilgeom" variable here
}
can anyone please help me...?
Thanks in Advance,
mammaiap
Re: how to access the Member Variable of MainWindow from another class?
This is basics of C++ and object oriented programing! Provide MainWindow method which will expose this field in safe way.
Re: how to access the Member Variable of MainWindow from another class?
what relation between AirfoilGeomTab and MainWindow, parent is MainWindow in AirfoilGeomTab's constructor?
And i think you'd better write set get function
3 Attachment(s)
Re: how to access the Member Variable of MainWindow from another class?
Hi Marek,
thanks for your immediate reply...
but can you please explain little bit more....with some code example?
Thanks in Advance
Added after 10 minutes:
Hi wong,
here i am attaching the source files
basically what i wanted is...
i am reading the input file and get some values....and store it in the container...
here(QList<int> cno_airfoilgeom) in mainwindow...
i wanted to use this value in some other class contructor...(class AirfoilGeomTab)..
i create a TabWidget which consist the "AirfoilGeomTab"...
thanks,