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. Stuck in this Error :::invalid use of incomplete type ‘class Ui::Dialog’ ui(new Ui::Dialog) ^~~~~~
Forum Updated to NodeBB v4.3 + New Features

Stuck in this Error :::invalid use of incomplete type ‘class Ui::Dialog’ ui(new Ui::Dialog) ^~~~~~

Scheduled Pinned Locked Moved Solved General and Desktop
27 Posts 5 Posters 3.8k 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.
  • S sankarapandiyan
    31 Oct 2019, 07:09

    dialog.cpp

    #include "dialog.h"
    #include "ui_dialog.h"
    #include <QProgressDialog>
    #include <QDebug>
    Dialog::Dialog(QWidget *parent) :
        QDialog(parent),
        ui(new Ui::Dialog)
    {
        ui->setupUi(this);
    }
    Dialog::~Dialog()
    {
        delete ui;
    }
    void Dialog::on_modalButton_clicked()
    {
        int numTasks = 100000;
        QProgressDialog progress("Task in progress...", "Cancel", 0, numTasks, this);
        progress.setWindowModality(Qt::WindowModal);
        for (int i = 0; i < numTasks; i++) {
            progress.setValue(i);
           if (progress.wasCanceled())
                break;
        }
        progress.setValue(numTasks);
    }
    void Dialog::on_modelessButton_clicked()
    {
        myTask = new MyTask;
    }
    
    J Online
    J Online
    J.Hilk
    Moderators
    wrote on 31 Oct 2019, 07:13 last edited by
    #4

    @sankarapandiyan nobody will be able to find the error here, show us your header file

    also pls use the code tag to display code:
    428d970c-1ba8-4f15-a496-2180a72170fe-image.png


    Be aware of the Qt Code of Conduct, when posting : https://forum.qt.io/topic/113070/qt-code-of-conduct


    Q: What's that?
    A: It's blue light.
    Q: What does it do?
    A: It turns blue.

    S 2 Replies Last reply 31 Oct 2019, 07:30
    1
    • C Christian Ehrlicher
      31 Oct 2019, 07:11

      So how did you name you widget in the designer? Looking into ui_dialog.h will show you that it's at least not 'Dialog'

      S Offline
      S Offline
      sankarapandiyan
      wrote on 31 Oct 2019, 07:29 last edited by
      #5

      @Christian-Ehrlicher in designer i have used only Dialog , then why its shows the error , please give some suggestion to fix this error

      1 Reply Last reply
      0
      • J J.Hilk
        31 Oct 2019, 07:13

        @sankarapandiyan nobody will be able to find the error here, show us your header file

        also pls use the code tag to display code:
        428d970c-1ba8-4f15-a496-2180a72170fe-image.png

        S Offline
        S Offline
        sankarapandiyan
        wrote on 31 Oct 2019, 07:30 last edited by
        #6

        @J-Hilk YEs i have done it .please give me some suggestion about the error

        J 1 Reply Last reply 31 Oct 2019, 07:31
        0
        • S sankarapandiyan
          31 Oct 2019, 07:30

          @J-Hilk YEs i have done it .please give me some suggestion about the error

          J Offline
          J Offline
          jsulm
          Lifetime Qt Champion
          wrote on 31 Oct 2019, 07:31 last edited by
          #7

          @sankarapandiyan He asked you to post the code...

          https://forum.qt.io/topic/113070/qt-code-of-conduct

          S 1 Reply Last reply 31 Oct 2019, 07:32
          0
          • J jsulm
            31 Oct 2019, 07:31

            @sankarapandiyan He asked you to post the code...

            S Offline
            S Offline
            sankarapandiyan
            wrote on 31 Oct 2019, 07:32 last edited by
            #8

            @jsulm sure check it

            1 Reply Last reply
            0
            • J J.Hilk
              31 Oct 2019, 07:13

              @sankarapandiyan nobody will be able to find the error here, show us your header file

              also pls use the code tag to display code:
              428d970c-1ba8-4f15-a496-2180a72170fe-image.png

              S Offline
              S Offline
              sankarapandiyan
              wrote on 31 Oct 2019, 07:37 last edited by
              #9

              @J-Hilk I have done it

              J 1 Reply Last reply 31 Oct 2019, 07:40
              0
              • S sankarapandiyan
                31 Oct 2019, 07:37

                @J-Hilk I have done it

                J Offline
                J Offline
                jsulm
                Lifetime Qt Champion
                wrote on 31 Oct 2019, 07:40 last edited by
                #10

                @sankarapandiyan said in Stuck in this Error :::invalid use of incomplete type ‘class Ui::Dialog’ ui(new Ui::Dialog) ^~~~~~:

                I have done it

                Where? I can't see the code from your header files anywhere...

                https://forum.qt.io/topic/113070/qt-code-of-conduct

                S 1 Reply Last reply 31 Oct 2019, 07:42
                0
                • J jsulm
                  31 Oct 2019, 07:40

                  @sankarapandiyan said in Stuck in this Error :::invalid use of incomplete type ‘class Ui::Dialog’ ui(new Ui::Dialog) ^~~~~~:

                  I have done it

                  Where? I can't see the code from your header files anywhere...

                  S Offline
                  S Offline
                  sankarapandiyan
                  wrote on 31 Oct 2019, 07:42 last edited by
                  #11

                  @jsulm i have done

                  J J 2 Replies Last reply 31 Oct 2019, 07:44
                  0
                  • S sankarapandiyan
                    31 Oct 2019, 07:42

                    @jsulm i have done

                    J Offline
                    J Offline
                    jsulm
                    Lifetime Qt Champion
                    wrote on 31 Oct 2019, 07:44 last edited by
                    #12

                    @sankarapandiyan Sorry, but I can't see it anywhere...

                    https://forum.qt.io/topic/113070/qt-code-of-conduct

                    1 Reply Last reply
                    0
                    • S sankarapandiyan
                      31 Oct 2019, 07:42

                      @jsulm i have done

                      J Online
                      J Online
                      J.Hilk
                      Moderators
                      wrote on 31 Oct 2019, 07:46 last edited by
                      #13

                      @sankarapandiyan neither can I


                      Be aware of the Qt Code of Conduct, when posting : https://forum.qt.io/topic/113070/qt-code-of-conduct


                      Q: What's that?
                      A: It's blue light.
                      Q: What does it do?
                      A: It turns blue.

                      1 Reply Last reply
                      1
                      • M Offline
                        M Offline
                        mrjj
                        Lifetime Qt Champion
                        wrote on 31 Oct 2019, 07:55 last edited by
                        #14

                        Hi
                        Please also show

                        dialog.h

                        and most important

                        ui_dialog.h

                        S 1 Reply Last reply 31 Oct 2019, 08:01
                        0
                        • M mrjj
                          31 Oct 2019, 07:55

                          Hi
                          Please also show

                          dialog.h

                          and most important

                          ui_dialog.h

                          S Offline
                          S Offline
                          sankarapandiyan
                          wrote on 31 Oct 2019, 08:01 last edited by sankarapandiyan
                          #15

                          @mrjj

                          ``

                          i have included #include <ui_dialog.h> in dialog.h 
                          
                          
                          
                          #ifndef DIALOG_H
                          #define DIALOG_H
                          
                          
                          #include <QDialog>
                          #include "mytask.h"
                          #include <ui_dialog.h>
                          namespace Ui {
                          class Dialog;
                          }
                           but the error remains the same   /home/adx-soft1/Desktop/Sankarapandiyan/ProgDial/dialog.cpp:10: error: invalid use of incomplete type ‘class Ui::Dialog’
                               ui(new Ui::Dialog)
                                          ^~~~~~
                          
                          
                          
                          this is my dialog.h 
                          
                          
                          #ifndef DIALOG_H
                          #define DIALOG_H
                          
                          
                          #include <QDialog>
                          #include "mytask.h"
                          #include <ui_dialog.h>
                          
                          
                          
                          namespace Ui {
                          class Dialog;
                          }
                          
                          class Dialog : public QDialog
                          {
                              Q_OBJECT
                          
                          public:
                              explicit Dialog(QWidget *parent = 0);
                              ~Dialog();
                          
                          private slots:
                              void on_modalButton_clicked();
                          
                              void on_modelessButton_clicked();
                          
                          private:
                              Ui::Dialog *ui;
                              MyTask *myTask;
                          };
                          
                          #endif // DIALOG_H
                          
                          
                          J 1 Reply Last reply 31 Oct 2019, 08:02
                          0
                          • S sankarapandiyan
                            31 Oct 2019, 08:01

                            @mrjj

                            ``

                            i have included #include <ui_dialog.h> in dialog.h 
                            
                            
                            
                            #ifndef DIALOG_H
                            #define DIALOG_H
                            
                            
                            #include <QDialog>
                            #include "mytask.h"
                            #include <ui_dialog.h>
                            namespace Ui {
                            class Dialog;
                            }
                             but the error remains the same   /home/adx-soft1/Desktop/Sankarapandiyan/ProgDial/dialog.cpp:10: error: invalid use of incomplete type ‘class Ui::Dialog’
                                 ui(new Ui::Dialog)
                                            ^~~~~~
                            
                            
                            
                            this is my dialog.h 
                            
                            
                            #ifndef DIALOG_H
                            #define DIALOG_H
                            
                            
                            #include <QDialog>
                            #include "mytask.h"
                            #include <ui_dialog.h>
                            
                            
                            
                            namespace Ui {
                            class Dialog;
                            }
                            
                            class Dialog : public QDialog
                            {
                                Q_OBJECT
                            
                            public:
                                explicit Dialog(QWidget *parent = 0);
                                ~Dialog();
                            
                            private slots:
                                void on_modalButton_clicked();
                            
                                void on_modelessButton_clicked();
                            
                            private:
                                Ui::Dialog *ui;
                                MyTask *myTask;
                            };
                            
                            #endif // DIALOG_H
                            
                            
                            J Offline
                            J Offline
                            jsulm
                            Lifetime Qt Champion
                            wrote on 31 Oct 2019, 08:02 last edited by
                            #16

                            @sankarapandiyan Can you please simply provide the content of ui_dialog.h? This is what we are asking all the time.

                            https://forum.qt.io/topic/113070/qt-code-of-conduct

                            S 1 Reply Last reply 31 Oct 2019, 09:16
                            1
                            • J jsulm
                              31 Oct 2019, 08:02

                              @sankarapandiyan Can you please simply provide the content of ui_dialog.h? This is what we are asking all the time.

                              S Offline
                              S Offline
                              sankarapandiyan
                              wrote on 31 Oct 2019, 09:16 last edited by
                              #17

                              @jsulm [url=https://postimg.cc/tZyZdZ4R][img]https://i.postimg.cc/tZyZdZ4R/Screenshot-from-2019-10-31-13-33-16.png[/img][/url]

                              [url=https://postimg.cc/rd5RtCcY][img]https://i.postimg.cc/rd5RtCcY/Screenshot-from-2019-10-31-13-33-28.png[/img][/url]

                              J 1 Reply Last reply 31 Oct 2019, 09:28
                              0
                              • S sankarapandiyan
                                31 Oct 2019, 09:16

                                @jsulm [url=https://postimg.cc/tZyZdZ4R][img]https://i.postimg.cc/tZyZdZ4R/Screenshot-from-2019-10-31-13-33-16.png[/img][/url]

                                [url=https://postimg.cc/rd5RtCcY][img]https://i.postimg.cc/rd5RtCcY/Screenshot-from-2019-10-31-13-33-28.png[/img][/url]

                                J Offline
                                J Offline
                                jsulm
                                Lifetime Qt Champion
                                wrote on 31 Oct 2019, 09:28 last edited by
                                #18

                                @sankarapandiyan This is not what we asked you to provide!
                                AGAIN: post the content of ui_dialog.h ! It is a normal C++ header file, so symply copy its text and post it here directly...

                                https://forum.qt.io/topic/113070/qt-code-of-conduct

                                S 1 Reply Last reply 31 Oct 2019, 09:35
                                1
                                • J jsulm
                                  31 Oct 2019, 09:28

                                  @sankarapandiyan This is not what we asked you to provide!
                                  AGAIN: post the content of ui_dialog.h ! It is a normal C++ header file, so symply copy its text and post it here directly...

                                  S Offline
                                  S Offline
                                  sankarapandiyan
                                  wrote on 31 Oct 2019, 09:35 last edited by
                                  #19

                                  @jsulm ```
                                  code_text

                                  #define DIALOG_H
                                  
                                  #include <QDialog>
                                  #include<QTimer>
                                  #include<QProgressDialog>
                                  
                                  namespace Ui {
                                  class Dialog;
                                  }
                                  
                                  class Dialog : public QDialog
                                  {
                                      Q_OBJECT
                                  
                                  public:
                                      explicit Dialog(QWidget *parent = nullptr);
                                      ~Dialog();
                                  public slots:
                                      void myfunction();
                                      void perform();
                                      void cancel();
                                  
                                  private:
                                      Ui::Dialog *ui;
                                      int steps;
                                      QProgressDialog*pd;
                                      QTimer*timer;
                                  };
                                  
                                  #endif // DIALOG_H
                                  This is the hedder file of dialog.h
                                  J 1 Reply Last reply 31 Oct 2019, 09:48
                                  0
                                  • S sankarapandiyan
                                    31 Oct 2019, 09:35

                                    @jsulm ```
                                    code_text

                                    #define DIALOG_H
                                    
                                    #include <QDialog>
                                    #include<QTimer>
                                    #include<QProgressDialog>
                                    
                                    namespace Ui {
                                    class Dialog;
                                    }
                                    
                                    class Dialog : public QDialog
                                    {
                                        Q_OBJECT
                                    
                                    public:
                                        explicit Dialog(QWidget *parent = nullptr);
                                        ~Dialog();
                                    public slots:
                                        void myfunction();
                                        void perform();
                                        void cancel();
                                    
                                    private:
                                        Ui::Dialog *ui;
                                        int steps;
                                        QProgressDialog*pd;
                                        QTimer*timer;
                                    };
                                    
                                    #endif // DIALOG_H
                                    This is the hedder file of dialog.h
                                    J Offline
                                    J Offline
                                    jsulm
                                    Lifetime Qt Champion
                                    wrote on 31 Oct 2019, 09:48 last edited by
                                    #20

                                    @sankarapandiyan Sorry I will stop here as I'm tired to explain that you simply need to copy text from ui_dialog.h and paste it here...

                                    https://forum.qt.io/topic/113070/qt-code-of-conduct

                                    S 1 Reply Last reply 31 Oct 2019, 10:03
                                    0
                                    • J jsulm
                                      31 Oct 2019, 09:48

                                      @sankarapandiyan Sorry I will stop here as I'm tired to explain that you simply need to copy text from ui_dialog.h and paste it here...

                                      S Offline
                                      S Offline
                                      sankarapandiyan
                                      wrote on 31 Oct 2019, 10:03 last edited by
                                      #21

                                      @jsulm i didnt have a content of ui dialog . h , And i am having dialog.h file only is there thats why i have uploaded repeatedly

                                      J 1 Reply Last reply 31 Oct 2019, 10:05
                                      0
                                      • S sankarapandiyan
                                        31 Oct 2019, 10:03

                                        @jsulm i didnt have a content of ui dialog . h , And i am having dialog.h file only is there thats why i have uploaded repeatedly

                                        J Online
                                        J Online
                                        J.Hilk
                                        Moderators
                                        wrote on 31 Oct 2019, 10:05 last edited by
                                        #22

                                        @sankarapandiyan
                                        it will not be inside QtCreator as it is a automatically created file.

                                        But you will find in in your build directory, if you use a normal file explorer, the one that comes with your operating system


                                        Be aware of the Qt Code of Conduct, when posting : https://forum.qt.io/topic/113070/qt-code-of-conduct


                                        Q: What's that?
                                        A: It's blue light.
                                        Q: What does it do?
                                        A: It turns blue.

                                        S 1 Reply Last reply 31 Oct 2019, 10:37
                                        3
                                        • J J.Hilk
                                          31 Oct 2019, 10:05

                                          @sankarapandiyan
                                          it will not be inside QtCreator as it is a automatically created file.

                                          But you will find in in your build directory, if you use a normal file explorer, the one that comes with your operating system

                                          S Offline
                                          S Offline
                                          sankarapandiyan
                                          wrote on 31 Oct 2019, 10:37 last edited by
                                          #23
                                          This post is deleted!
                                          M 1 Reply Last reply 31 Oct 2019, 10:50
                                          0

                                          13/27

                                          31 Oct 2019, 07:46

                                          • Login

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