How to reach variable from another page in Qt C++?
Unsolved
General and Desktop
-
have 2 function in different c++ files. I need reach one variable from another cpp file. How Can I do this?
I need reach excelBuffer located on parser.cpp on inside void MainWindow::exportexcel() function located on mainwindow.cpp
parser.cpp
void Parser::parse(QString inputString) { QStringList excelBuffer =inputString.split(","); }
mainwindow.cpp
void MainWindow::exportexcel() { //I need reach excelbuffer from here }
-
Usually, we use getters/setters to do this.
-
@mangekoyu said in How to reach variable from another page in Qt C++?:
I need reach excelBuffer located on parser.cpp
You will need to make excelBuffer class member instead of local variable and then follow what @odelaune suggested.