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. I am getting the error "field ui1 has incomplete type". I am a beginner . Please help.
Forum Updated to NodeBB v4.3 + New Features

I am getting the error "field ui1 has incomplete type". I am a beginner . Please help.

Scheduled Pinned Locked Moved General and Desktop
7 Posts 3 Posters 4.9k 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.
  • V Offline
    V Offline
    Vikramjeet
    wrote on last edited by
    #1

    File name dialog.h
    @#ifndef LISTDIALOG_H
    #define LISTDIALOG_H

    #include <QDialog>

    namespace Ui {
    class ListDialog;
    class EditDialog;
    }
    class ListDialog : public QDialog
    {
    Q_OBJECT

    public:
    explicit ListDialog(QWidget *parent = 0);
    ~ListDialog();

    public slots:
    void addItem();
    void editItem();
    void deleteItem();

    private:
    Ui::ListDialog *ui;
    };
    class EditDialog:public QDialog
    {
    public:
    EditDialog(QWidget *parent=0);
    const QString name() const;
    void setName(const QString&);
    private:
    Ui::EditDialog ui1;

    };

    #endif // LISTDIALOG_H@

    The dialog.cpp file is

    @#include "dialog.h"
    #include "ui_dialog.h"
    #include "ui_editdialog.h"
    ListDialog::ListDialog(QWidget *parent) :
    QDialog(parent),
    ui(new Ui::ListDialog)
    {
    ui->setupUi(this);
    }

    ListDialog::~ListDialog()
    {
    delete ui;
    }

    EditDialog::EditDialog(QWidget *parent):QDialog(parent)
    {

    ui1.setupUi(this);
    

    }

    void ListDialog::addItem()
    {
    //EditDialog dlg(this);
    //dlg.exec();
    }
    void ListDialog::editItem(){}
    void ListDialog::deleteItem(){}@

    1 Reply Last reply
    0
    • Q Offline
      Q Offline
      QMartin
      wrote on last edited by
      #2

      Hi!

      It seems you are mixing two forms in one, and the UIC compiler gets lost somewhere. If I'm not wrong, in your project you only have one form .ui, whose name is ListDialog. Look inside ui_dialog.h and you may find something like

      @namespace Ui {
      class ListDialog: public Ui_Dialog {};
      } // namespace Ui

      QT_END_NAMESPACE@

      So when pressing CTRL and clicking over your ListDialog in

      @namespace Ui {
      class ListDialog; //click this one
      class EditDialog;
      }@

      Qt must jump to that part of the code. If you repeat this operation with your EditDialog, Qt will remain in the same file. That means there is no .ui file for your EditDialog. This should be the reason why you get that message. So, go on, create a new form and be sure to specify its name correctly. Then include the autogenerated header ui_whateverNameYouUsed.h it in your .cpp and re-compile.

      If you have any doubts, just ask. Good luck!

      1 Reply Last reply
      0
      • J Offline
        J Offline
        joergpauly
        wrote on last edited by
        #3

        What I see:

        You instantiate an object of a class in it's own declaration.
        I may be wrong, but I can imagine this couldn't work...

        Greetings
        Joerg

        1 Reply Last reply
        0
        • V Offline
          V Offline
          Vikramjeet
          wrote on last edited by
          #4

          No I have two user interfaces editdialog.ui and listdialog.ui

          1 Reply Last reply
          0
          • V Offline
            V Offline
            Vikramjeet
            wrote on last edited by
            #5

            [quote author="QMartin" date="1360692450"]Hi!

            It seems you are mixing two forms in one, and the UIC compiler gets lost somewhere. If I'm not wrong, in your project you only have one form .ui, whose name is ListDialog. Look inside ui_dialog.h and you may find something like

            @namespace Ui {
            class ListDialog: public Ui_Dialog {};
            } // namespace Ui

            QT_END_NAMESPACE@

            So when pressing CTRL and clicking over your ListDialog in

            @namespace Ui {
            class ListDialog; //click this one
            class EditDialog;
            }@

            Qt must jump to that part of the code. If you repeat this operation with your EditDialog, Qt will remain in the same file. That means there is no .ui file for your EditDialog. This should be the reason why you get that message. So, go on, create a new form and be sure to specify its name correctly. Then include the autogenerated header ui_whateverNameYouUsed.h it in your .cpp and re-compile.

            If you have any doubts, just ask. Good luck![/quote]

            I have created two interfaces editdialog.ui and listdialog.ui

            1 Reply Last reply
            0
            • V Offline
              V Offline
              Vikramjeet
              wrote on last edited by
              #6

              https://skydrive.live.com/redir?resid=BBF9030540A807A5!802&authkey=!AJuQindum4ud4bw

              This is compressed form of my QT Project.

              1 Reply Last reply
              0
              • V Offline
                V Offline
                Vikramjeet
                wrote on last edited by
                #7

                Thanks your suggestion solved my problem.

                1 Reply Last reply
                0

                • Login

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