Use UI array in a function Qt C++
问题 In my Windows forms code, ui is used to define graphical element by default. But I want to modify them in a function, like this: The problems is that the debug tool tells me that ui is not declared in this scope. #include <QMessageBox> #include <QFile> #include <QTextStream> #include "mainwindow.h" #include "ui_mainwindow.h" #include "datawindow.h" void getData(ui){ QFile inputFile("C:\\pepoles.txt"); if (inputFile.open(QIODevice::ReadOnly)){ QTextStream in(&inputFile); while ( !in.atEnd() ){