Answer the question
In order to leave comments, you need to log in
Qt. How to pass data between forms?
There is a main form:
class MainWindow
{
...
private:
...
QList<Institution> institutions;
};
class AddItem
{
...
};
void MainWindow::on_action_add_item_triggered()
{
AddItem *form_2 = new AddItem(this);
form_2->show();
}
QList<Institution> institutions
to the second form so that the collection can be edited in it?
Answer the question
In order to leave comments, you need to log in
By non-const reference (or pointer):
class AddItem
{
AddItem(MainWindow *parent, QList<Institution>& ins);
...
private:
QList<Institution>& parent_institutions;
};
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question