T
T
tschin2015-11-14 14:27:16
Qt
tschin, 2015-11-14 14:27:16

How to work correctly with form elements from another form in qt?

Hello! I'm trying to learn how to work with multiple forms in Qt.
There are two forms. Now in MainWindow I do this:

checkFileForm *fileF = new checkFileForm;
fileF->show();

Next, you need to change to checkFileForm, for example, the text of the button.
In checkFileForm.h I write:
public:
QPushButton *button;

checkFileForm.cpp
checkFileForm::checkFileForm(QWidget *parent) :
    QWidget(parent),
    ui(new Ui::checkFileForm)
{
    ui->setupUi(this);
    button = ui->pushButton;
}

Well, then through the signals and slots I do everything that I need.
The question is, is the mechanism for working with form elements from another form correct? Or is there a better way to work?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
J
Jacob E, 2015-11-14
@Zifix

No need to do anything by hand, use QtDesigner's widget conversion mechanism for this purpose.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question