Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. how to match a ui file to a pre-existing project

how to match a ui file to a pre-existing project

Scheduled Pinned Locked Moved Solved General and Desktop
2 Posts 2 Posters 257 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • F Offline
    F Offline
    frnklu20
    wrote on last edited by frnklu20
    #1

    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!

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      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".

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      1

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved