Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. General talk
  3. Brainstorm
  4. implementing a dynamic display
Forum Updated to NodeBB v4.3 + New Features

implementing a dynamic display

Scheduled Pinned Locked Moved Solved Brainstorm
33 Posts 6 Posters 12.3k Views 4 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.
  • M mzimmers
    14 Nov 2017, 23:44

    I've tried to implement a new class (patterned after my main form)...obviously I don't understand something.

    Here's the header:

    #ifndef CREDENTIALS_H
    #define CREDENTIALS_H
    
    #include <QWidget>
    
    namespace Ui
    {
        class Credentials;
    }
    class Credentials : public QWidget
    {
        Q_OBJECT
    public:
        explicit Credentials(QWidget *parent = nullptr);
    private:
        Ui::Credentials *uiCredentials;
    };
    
    #endif // CREDENTIALS_H
    

    and here's the source:

    #include "credentials.h"
    #include "ui_credentials.h"
    
    Credentials::Credentials(QWidget *parent)
        : QWidget(parent),
          uiCredentials(new Ui::Credentials)
    
    {
        uiCredentials->setupUi(this);
    }
    

    I'm getting an error "invalid use of incomplete type 'class Ui::Credentials'. Why is it incomplete?

    K Offline
    K Offline
    kshegunov
    Moderators
    wrote on 15 Nov 2017, 08:25 last edited by kshegunov
    #24
    #include "ui_credentials_form_file_name.h"
    

    Read and abide by the Qt Code of Conduct

    1 Reply Last reply
    2
    • M Offline
      M Offline
      mzimmers
      wrote on 15 Nov 2017, 15:16 last edited by
      #25

      I think I'm already doing that -- in the source file:

      #include "credentials.h"
       ***** #include "ui_credentials.h" *****
      Credentials::Credentials(QWidget *parent)
      

      0_1510758968869_credential.PNG

      1 Reply Last reply
      0
      • S Offline
        S Offline
        SGaist
        Lifetime Qt Champion
        wrote on 15 Nov 2017, 15:19 last edited by
        #26

        Did you re-run qmake after adding your new form ?

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

        M 1 Reply Last reply 15 Nov 2017, 15:22
        0
        • S SGaist
          15 Nov 2017, 15:19

          Did you re-run qmake after adding your new form ?

          M Offline
          M Offline
          mzimmers
          wrote on 15 Nov 2017, 15:22 last edited by
          #27

          @SGaist Yes. (I just tried it again to be sure.) I even did a clean/qmake/build...same results.

          K 1 Reply Last reply 15 Nov 2017, 15:31
          0
          • M mzimmers
            15 Nov 2017, 15:22

            @SGaist Yes. (I just tried it again to be sure.) I even did a clean/qmake/build...same results.

            K Offline
            K Offline
            kshegunov
            Moderators
            wrote on 15 Nov 2017, 15:31 last edited by
            #28

            And is the root object of your form called "Credentials" (look for it when you open the form in the designer - in the right, in the object tree the first object's name)?

            Read and abide by the Qt Code of Conduct

            1 Reply Last reply
            3
            • M Offline
              M Offline
              mzimmers
              wrote on 15 Nov 2017, 15:42 last edited by
              #29

              Aha! That did the trick. Thanks, kshegunov. It was simply called "Dialog."

              So, the step I missed was matching the name of the top-level object created in Designer with the new class I created manually to support it. I looked past this because the first form (and its supporting class) was created automatically when I started the project.

              Thanks again.

              M 1 Reply Last reply 16 Nov 2017, 22:42
              2
              • M mzimmers
                15 Nov 2017, 15:42

                Aha! That did the trick. Thanks, kshegunov. It was simply called "Dialog."

                So, the step I missed was matching the name of the top-level object created in Designer with the new class I created manually to support it. I looked past this because the first form (and its supporting class) was created automatically when I started the project.

                Thanks again.

                M Offline
                M Offline
                mrjj
                Lifetime Qt Champion
                wrote on 16 Nov 2017, 22:42 last edited by mrjj
                #30

                @mzimmers
                Hi
                Just as a note. you can add as many forms as you like and
                have them auto created like mainwindow is.

                It sounds you manually created Credentials ?

                To get a new form, simply right click top of project, select "Add new" and then
                alt text
                In next window, you can choose if it should be MainWindow, Dialog or Widget.

                This way you get .ui, cpp and h all ready to go.

                maybe i misunderstood but just in case :)

                M 1 Reply Last reply 16 Nov 2017, 22:43
                2
                • M mrjj
                  16 Nov 2017, 22:42

                  @mzimmers
                  Hi
                  Just as a note. you can add as many forms as you like and
                  have them auto created like mainwindow is.

                  It sounds you manually created Credentials ?

                  To get a new form, simply right click top of project, select "Add new" and then
                  alt text
                  In next window, you can choose if it should be MainWindow, Dialog or Widget.

                  This way you get .ui, cpp and h all ready to go.

                  maybe i misunderstood but just in case :)

                  M Offline
                  M Offline
                  mzimmers
                  wrote on 16 Nov 2017, 22:43 last edited by
                  #31

                  @mrjj oh, that's good to know about. I looked right past that and just created the form from the line below. Thanks, mrjj...I'll remember that for the (not so distant) future.

                  M 1 Reply Last reply 16 Nov 2017, 22:48
                  0
                  • M mzimmers
                    16 Nov 2017, 22:43

                    @mrjj oh, that's good to know about. I looked right past that and just created the form from the line below. Thanks, mrjj...I'll remember that for the (not so distant) future.

                    M Offline
                    M Offline
                    mrjj
                    Lifetime Qt Champion
                    wrote on 16 Nov 2017, 22:48 last edited by
                    #32

                    @mzimmers
                    Ah, yep that gives you just the ui file which is useful for hooking somes some interface up
                    with existing code. But not so much for a brand new window/dialog. :)

                    1 Reply Last reply
                    1
                    • MRenM Offline
                      MRenM Offline
                      MRen
                      wrote on 24 Dec 2017, 17:36 last edited by
                      #33

                      Just as a note. you can add as many forms as you like and
                      have them auto created like mainwindow is.

                      P.s.:Hi

                      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