Hi,
I would like to use QFormLayout for a typical form-like widget and my problem is that I don't know to extract any data from my form. Now I just made a small example for learning purposes, there I have this:
class MainWindow : public QMainWindow
{
Q_OBJECT
public:
explicit MainWindow
(QWidget *parent
= 0);
~MainWindow();
private:
Ui::MainWindow *ui;
QFormLayout * formlo;
};
{
Q_OBJECT
public:
explicit MainWindow(QWidget *parent = 0);
~MainWindow();
private:
Ui::MainWindow *ui;
QFormLayout * formlo;
QGroupBox *formGroupBox;
};
To copy to clipboard, switch view to plain text mode
and this:
MainWindow
::MainWindow(QWidget *parent
) : ui(new Ui::MainWindow)
{
ui->setupUi(this);
this->formlo = new QFormLayout;
formGroupBox
= new QGroupBox(tr
("Form layout"));
formGroupBox->setLayout(formlo);
ui->formLayout->addWidget(formGroupBox);
}
MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::MainWindow)
{
ui->setupUi(this);
this->formlo = new QFormLayout;
this->formlo->addRow(new QLabel("Elso sor:"),new QLineEdit);
formGroupBox = new QGroupBox(tr("Form layout"));
formGroupBox->setLayout(formlo);
ui->formLayout->addWidget(formGroupBox);
}
To copy to clipboard, switch view to plain text mode
which works perfect, but no form is without purpose, so now I can't find the way how to extract the user-given input data from the QLineEdit. I thought maybe itemAt() could be my friend, but I'm not that sure about that, I'm a bit confused actually. Is there maybe a good built-in example? The "Basic Layouts" one gives hints only for displaying.
Bookmarks