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. QT Gui Application, alingment and/or anchoring...
Forum Updated to NodeBB v4.3 + New Features

QT Gui Application, alingment and/or anchoring...

Scheduled Pinned Locked Moved General and Desktop
23 Posts 4 Posters 13.7k 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.
  • D Offline
    D Offline
    dcbasso
    wrote on last edited by
    #10

    Andre, where I can find this information (in docs and other stuffs)?

    1 Reply Last reply
    0
    • A Offline
      A Offline
      andre
      wrote on last edited by
      #11

      In the documentation, where I found it too!

      However, I will admit that module information is not always easy to find, and in fact in this case I made a mistake here: uitools contains the QUiLoader class, but not the QFormBuilder class. The QFormBuilder class resides in the QtDesigner module, which you can add to your project using
      @
      CONFIG += designer
      @

      There is a reference to the uitools module in both the documentation of QFormBuilder and QUiLoader though, hence my confusion. The module page will give an overview of the classes in the module, and the .pro statement to use it.

      1 Reply Last reply
      0
      • D Offline
        D Offline
        dcbasso
        wrote on last edited by
        #12

        Thanks.
        Now I can continue my study with QT!
        I'm still trying to load the .ui on a widget component, it's not easy to do so.

        1 Reply Last reply
        0
        • A Offline
          A Offline
          andre
          wrote on last edited by
          #13

          It is not clear what you want to achieve to me. Why are you not using the "standard way":/doc/qt-4.8/designer-using-a-ui-file.html to use a .ui file?

          1 Reply Last reply
          0
          • D Offline
            D Offline
            dcbasso
            wrote on last edited by
            #14

            I have to many User Interface On My Application, and I was thinking to create a menu button and every button will change the contextWidget...
            Undestand?

            1 Reply Last reply
            0
            • A Offline
              A Offline
              andre
              wrote on last edited by
              #15

              Nope. No idea.

              1 Reply Last reply
              0
              • D Offline
                D Offline
                dcbasso
                wrote on last edited by
                #16

                Well...
                My application will have many screens... something about 23 screens (User Interface).
                It is complex to make all this screen on a single .ui file, and I was thinking to create a .ui file for every screen, because all screen will have many controls and elements (buttons, text area, comboBox and etc...)!

                So, my main UI (main.ui) will have the menu buttons on right side on screen and just want to change the "central elements" of this screen. This "central elements" I would to to load the .ui file on set on them...

                Undestand?

                1 Reply Last reply
                0
                • A Offline
                  A Offline
                  andre
                  wrote on last edited by
                  #17

                  Ok, yes.

                  Notice that those screens will then become separate classes. That may or may not be what you want; usually it is exactly what you want.

                  You can use the method I pointed you to earlier to create these classes using your .ui files. Then, in your main file, you add these as pages in your view. I find it easiest to do that in code.

                  1 Reply Last reply
                  0
                  • D Offline
                    D Offline
                    dcbasso
                    wrote on last edited by
                    #18

                    The UiTools Approach

                    @ QWidget* TextFinder::loadUiFile()
                    {
                    QUiLoader loader;

                     QFile file(":/forms/textfinder.ui");
                     file.open(QFile::ReadOnly);
                    
                     QWidget *formWidget = loader.load(&file, this);
                     file.close();
                    
                     return formWidget;
                    

                    }@

                    It's that you are saying?

                    Thanks Andre, I was thinking that Was my Crazy Idea to make something like this, but Now I see that can be done in Qt.

                    Thank you very much.

                    1 Reply Last reply
                    0
                    • A Offline
                      A Offline
                      andre
                      wrote on last edited by
                      #19

                      You probably don't need UiLoader or QFormBuilder. I have, in the 10 or so years I now work with Qt, only used these once or twice. If you've just started using Qt, chances are they really are not what you need.

                      Just use the approach described in the first section of "the documentation":/doc/qt-4.8/designer-using-a-ui-file.html on how to use .ui files. This is also the standard way everything is created if you use File -> New File or Project -> Qt -> Qt Designer Form Class. Use that approach to create your pages. If you want to put all of those pages on a main form, use either code to create instances of your different widgets and add them to a tab widget on your main form, or add them from the main form .ui file using widget promotion.

                      1 Reply Last reply
                      0
                      • D Offline
                        D Offline
                        dcbasso
                        wrote on last edited by
                        #20

                        Sorry Andre, It's a very different concept for me and I'm not understanding how can I make this works....

                        I try this:
                        @
                        WidgetMCI wMCI;
                        ui->contentWidget->layout()->addWidget( &wMCI );
                        @

                        but another runtime error appers!
                        I have used "File -> New File or Project -> Qt -> Qt Designer Form Class".

                        1 Reply Last reply
                        0
                        • D Offline
                          D Offline
                          dcbasso
                          wrote on last edited by
                          #21

                          I try do this too and nothing:

                          @
                          WidgetMCI *wMCI = new WidgetMCI( this );
                          contentWidget->layout()->addWidget( wMCI );
                          @

                          1 Reply Last reply
                          0
                          • D Offline
                            D Offline
                            dcbasso
                            wrote on last edited by
                            #22

                            Sorry, my layout was missing the layout component to handle with added widget!

                            1 Reply Last reply
                            0
                            • A Offline
                              A Offline
                              andre
                              wrote on last edited by
                              #23

                              [quote author="dcbasso" date="1341259385"]Sorry, my layout was missing the layout component to handle with added widget![/quote]

                              So... it is solved?

                              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