That example seems to be an odd one - it uses a ui file that doesn't seem to do anything (since you code the gui) and it just add "stuff" to layout without naming the "stuff" so that you can use the name to access the gui elements.
I suggest you learn both ways to code the gui (designer and usage of ui file or code the layouts manually).
Anyway to correct the "design" you can declare pointers to the QLabel and to the QLineEdit in the class header (members your class) and then write this:
label
= new QLabel("Elso sor:");
//declared i header: QLabel* label;lineEdit
= new QLineEdit;
//declared: QLineEdit* lineEdit;
this->formlo->addRow(label, lineEdit);
label = new QLabel("Elso sor:"); //declared i header: QLabel* label;
lineEdit = new QLineEdit; //declared: QLineEdit* lineEdit;
this->formlo->addRow(label, lineEdit);
To copy to clipboard, switch view to plain text mode
Then you can use the pointer directly (without casting), example to get the QString from lineEdit:
QString textFromLineEdit
= lineEdit
->text
();
QString textFromLineEdit = lineEdit->text();
To copy to clipboard, switch view to plain text mode
Bookmarks