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 10.2k 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.
  • mzimmersM Offline
    mzimmersM Offline
    mzimmers
    wrote on last edited by
    #11

    There may be multiple products (of varying types) on the network. The user needs to know which one, by product name, he wishes to access. When he chooses one, I can then determine what UI components to display.

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

      So indeed, a plugin based architecture might be best suited for that.

      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
      • tekojoT Offline
        tekojoT Offline
        tekojo
        wrote on last edited by
        #13

        Kind of an unrelated note.
        It sounds like the application is for specialist use only. Can you go and ask one of the end users what they really want to do and in what order they would like to do it?

        So the products broadcast or reply to a broadcast on the network, so they can be identified? This would make it much easier for the network case.

        From the architecture side, a plugin approach makes most sense, especially as you expect future additions and changes.

        mzimmersM 1 Reply Last reply
        1
        • tekojoT tekojo

          Kind of an unrelated note.
          It sounds like the application is for specialist use only. Can you go and ask one of the end users what they really want to do and in what order they would like to do it?

          So the products broadcast or reply to a broadcast on the network, so they can be identified? This would make it much easier for the network case.

          From the architecture side, a plugin approach makes most sense, especially as you expect future additions and changes.

          mzimmersM Offline
          mzimmersM Offline
          mzimmers
          wrote on last edited by
          #14

          @tekojo I wish I could poll the user community on this matter -- I always like hearing from end-users before implementing an app. Unfortunately that option isn't available to me at this time.

          Regarding using plugins: that might be overkill, given that there are only two levels of user access, and only a few levels of app functionality. I also need to be concerned with distribution, and I'm not really familiar with plugins, but a plugin exists in a separate file, right? So can I still do a static build to create a monolithic distribution entity?

          1 Reply Last reply
          1
          • mzimmersM Offline
            mzimmersM Offline
            mzimmers
            wrote on last edited by
            #15

            I've decided to implement the additional fields using a QDialog object. I created a second form for this dialog, but then realized I don't know how to access this form programmatically. Can someone point me to some directions on this? I've done some looking but haven't found anything that tells me how to connect up a second form.

            Clarification: I know that I want the form to be enabled when a button push delivers a signal, but I don't know how to "point to" this form programatically. I hope this makes sense; I've been struggling to find the right words to explain what I'm looking for.

            Thanks...

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

              You usually subclass QDialog and give it the necessary API to access what you want. Depending on what you want to add, you can also simply hide what should not be used.

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

              mzimmersM 1 Reply Last reply
              1
              • SGaistS SGaist

                You usually subclass QDialog and give it the necessary API to access what you want. Depending on what you want to add, you can also simply hide what should not be used.

                mzimmersM Offline
                mzimmersM Offline
                mzimmers
                wrote on last edited by
                #17

                @SGaist so each form would then have its own subclass?

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

                  Just to be sure we are talking about the same thing, what do you mean by form ?

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

                  mzimmersM 1 Reply Last reply
                  0
                  • SGaistS SGaist

                    Just to be sure we are talking about the same thing, what do you mean by form ?

                    mzimmersM Offline
                    mzimmersM Offline
                    mzimmers
                    wrote on last edited by
                    #19

                    @SGaist by "form" I mean an entry under "Forms" in the project file; ie, a file with a .ui extension that is generated by Designer.

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

                      Then that's the most common use case. You create as many "Forms" you need and give them the API you need.

                      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
                      • mzimmersM Offline
                        mzimmersM Offline
                        mzimmers
                        wrote on last edited by
                        #21

                        I see. So, when I created this project, I selected Qt Widgets Application, and Creator automatically set up the form and the class for me. Should I use that class as a model for my new form?

                        I still don't quite understand how the program "knows" to use the .ui file. I don't see the connection anywhere in my code.

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

                          It's just a starting point. Nothing forbids you to have several forms.

                          The .uil file is processed by uic to generate code (a bit like moc for QObject based classes) then the ui.setupUi(this); line does the "magic" to setup everything you prepared with Designer.

                          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
                          • mzimmersM Offline
                            mzimmersM Offline
                            mzimmers
                            wrote on last edited by
                            #23

                            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?

                            kshegunovK 1 Reply Last reply
                            0
                            • mzimmersM mzimmers

                              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?

                              kshegunovK Offline
                              kshegunovK Offline
                              kshegunov
                              Moderators
                              wrote on 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
                              • mzimmersM Offline
                                mzimmersM Offline
                                mzimmers
                                wrote on 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
                                • SGaistS Offline
                                  SGaistS Offline
                                  SGaist
                                  Lifetime Qt Champion
                                  wrote on 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

                                  mzimmersM 1 Reply Last reply
                                  0
                                  • SGaistS SGaist

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

                                    mzimmersM Offline
                                    mzimmersM Offline
                                    mzimmers
                                    wrote on last edited by
                                    #27

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

                                    kshegunovK 1 Reply Last reply
                                    0
                                    • mzimmersM mzimmers

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

                                      kshegunovK Offline
                                      kshegunovK Offline
                                      kshegunov
                                      Moderators
                                      wrote on 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
                                      • mzimmersM Offline
                                        mzimmersM Offline
                                        mzimmers
                                        wrote on 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.

                                        mrjjM 1 Reply Last reply
                                        2
                                        • mzimmersM mzimmers

                                          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.

                                          mrjjM Offline
                                          mrjjM Offline
                                          mrjj
                                          Lifetime Qt Champion
                                          wrote on 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 :)

                                          mzimmersM 1 Reply Last reply
                                          2

                                          • Login

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