how to match a ui file to a pre-existing project
Solved
General and Desktop
-
I know that is a stupid question, but my point is:
I have a .h and .cpp files named equipamentos, and in this file i defined 2 different classes BarramDialog and LinhaDialog. I have 2 ui files too, linha.ui and barramdialog.ui
How can initialize the barramdialog.ui when i call the the barramdialog class and call linha.ui when i call linhadialog class?
equipamentos.h
namespace Ui { class BarramDialog; } class BarramDialog : public QDialog { Q_OBJECT public: explicit BarramDialog(QWidget *parent = nullptr); ~BarramDialog(); QString nome_dialog(QString &); void setdata(QList<QString>&); QList<QString> data=QList<QString>() <<"pegadinha"<<""<<""<<""; private slots: void on_ok_button_clicked(); private: Ui::BarramDialog *ui; void changevalues(int i, QString value); }; namespace Ui { class LinhaDialog; } class LinhaDialog : public QDialog { Q_OBJECT public: explicit LinhaDialog(QWidget *parent = nullptr); ~LinhaDialog(); void setdata(QList<QString>&); QList<QString> data=QList<QString>() <<"pegadinha"<<""<<""<<""; private: Ui::LinhaDialog *ui; };
equipamentos.cpp
#include "equipamentos.h" #include "ui_barramdialog.h" #include "linha.ui" BarramDialog::BarramDialog(QWidget *parent) : QDialog(parent), ui(new Ui::BarramDialog) {... }//works just fine LinhaDialog::LinhaDialog(QWidget *parent) : QDialog(parent), ui(new Ui::LinhaDialog)// error: allocation of incomplete type 'Ui::LinhaDialog' equipamentos.h:31:7: note: forward declaration of 'Ui::LinhaDialog' { }
how the program will know wich class will use each .ui file?
help me please! -
Hi,
@frnklu20 said in how to match a ui file to a pre-existing project:
linha.ui
That's wrong, you need to include "ui_linha.h".