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. How to get Widget from UI file
Forum Updated to NodeBB v4.3 + New Features

How to get Widget from UI file

Scheduled Pinned Locked Moved Unsolved General and Desktop
19 Posts 5 Posters 2.3k Views 2 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.
  • J J.Hilk
    20 Jun 2022, 13:09

    @SPlatten have you considered checking the auto generated "ui_class.h"file and simply taking the c++ code of your tabs from there and than using that code to create them yourself?

    S Offline
    S Offline
    SPlatten
    wrote on 20 Jun 2022, 13:13 last edited by
    #8

    @J-Hilk , looking at the header ui_ws_status_page.h, this contains the class Ui_WsStatusPage which does have everything I need, however I've just searched the file system for Ui_WsStatusPage and there are no references to it, how to I use it?

    Kind Regards,
    Sy

    J 1 Reply Last reply 20 Jun 2022, 13:16
    0
    • S SPlatten
      20 Jun 2022, 13:13

      @J-Hilk , looking at the header ui_ws_status_page.h, this contains the class Ui_WsStatusPage which does have everything I need, however I've just searched the file system for Ui_WsStatusPage and there are no references to it, how to I use it?

      J Offline
      J Offline
      JonB
      wrote on 20 Jun 2022, 13:16 last edited by
      #9

      @SPlatten
      Please just look (carefully) at the code. I said before

      Whatever, the answer lies in looking in tabwidget.h and/or ui_tabwidget.h since those are the entire code.

      If you don't follow put in breakpoints and step through, there is no magic and nothing external here.

      S 1 Reply Last reply 20 Jun 2022, 13:18
      0
      • J JonB
        20 Jun 2022, 13:16

        @SPlatten
        Please just look (carefully) at the code. I said before

        Whatever, the answer lies in looking in tabwidget.h and/or ui_tabwidget.h since those are the entire code.

        If you don't follow put in breakpoints and step through, there is no magic and nothing external here.

        S Offline
        S Offline
        SPlatten
        wrote on 20 Jun 2022, 13:18 last edited by
        #10

        @JonB , looking at the class as I said it does contain everything I need but I cannot find Ui_WsStatusPage (Class name) anywhere else in the file system or source code except in the header file itself.

        Kind Regards,
        Sy

        J 1 Reply Last reply 20 Jun 2022, 13:19
        0
        • S SPlatten
          20 Jun 2022, 13:18

          @JonB , looking at the class as I said it does contain everything I need but I cannot find Ui_WsStatusPage (Class name) anywhere else in the file system or source code except in the header file itself.

          J Offline
          J Offline
          JonB
          wrote on 20 Jun 2022, 13:19 last edited by JonB
          #11

          @SPlatten
          So put a breakpoint on its constructor, and on setupUi()..... If you are right, they will never be called and you can ignore all their code.

          S 1 Reply Last reply 20 Jun 2022, 13:20
          0
          • J JonB
            20 Jun 2022, 13:19

            @SPlatten
            So put a breakpoint on its constructor, and on setupUi()..... If you are right, they will never be called and you can ignore all their code.

            S Offline
            S Offline
            SPlatten
            wrote on 20 Jun 2022, 13:20 last edited by
            #12

            @JonB said in How to get Widget from UI file:

            I wish I could, but the project is built with cmake, not in Qt Creator, I can only run it in the console.

            Kind Regards,
            Sy

            J J 2 Replies Last reply 20 Jun 2022, 13:21
            0
            • S SPlatten
              20 Jun 2022, 13:20

              @JonB said in How to get Widget from UI file:

              I wish I could, but the project is built with cmake, not in Qt Creator, I can only run it in the console.

              J Offline
              J Offline
              JKSH
              Moderators
              wrote on 20 Jun 2022, 13:21 last edited by
              #13

              @SPlatten said in How to get Widget from UI file:

              I wish I could, but the project is built with cmake, not in Qt Creator, I can only run it in the console.

              You can use Qt Creator to open a CMakeLists.txt project and run console applications.

              Qt Doc Search for browsers: forum.qt.io/topic/35616/web-browser-extension-for-improved-doc-searches

              1 Reply Last reply
              1
              • S SPlatten
                20 Jun 2022, 13:20

                @JonB said in How to get Widget from UI file:

                I wish I could, but the project is built with cmake, not in Qt Creator, I can only run it in the console.

                J Offline
                J Offline
                JonB
                wrote on 20 Jun 2022, 13:23 last edited by
                #14

                @SPlatten
                Then edit the code to put in a qDebug(), or a message box, or a print to file, or whatever....

                Or, comment out that class, since you have said it is never used, and recompile.

                S 1 Reply Last reply 20 Jun 2022, 13:28
                0
                • J JonB
                  20 Jun 2022, 13:23

                  @SPlatten
                  Then edit the code to put in a qDebug(), or a message box, or a print to file, or whatever....

                  Or, comment out that class, since you have said it is never used, and recompile.

                  S Offline
                  S Offline
                  SPlatten
                  wrote on 20 Jun 2022, 13:28 last edited by
                  #15

                  @JonB , can I edit the content of ui_ws_status_page.h and add to it?

                  Kind Regards,
                  Sy

                  J 1 Reply Last reply 20 Jun 2022, 13:30
                  0
                  • S SPlatten
                    20 Jun 2022, 13:28

                    @JonB , can I edit the content of ui_ws_status_page.h and add to it?

                    J Offline
                    J Offline
                    jsulm
                    Lifetime Qt Champion
                    wrote on 20 Jun 2022, 13:30 last edited by
                    #16

                    @SPlatten Your changes will be overridden next time this header file is generated

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

                    S 1 Reply Last reply 20 Jun 2022, 13:32
                    1
                    • J jsulm
                      20 Jun 2022, 13:30

                      @SPlatten Your changes will be overridden next time this header file is generated

                      S Offline
                      S Offline
                      SPlatten
                      wrote on 20 Jun 2022, 13:32 last edited by
                      #17

                      @jsulm , ok, so how can I fix the tabs in the UI to do what I want? I'm done this without the tabs in the UI but its to be a job to rip it all apart. Right now I need to call setTabBar after all the initialisation has completed with the tabs added, but I cannot all setTTabBar outside of the class as its a protected method.

                      Kind Regards,
                      Sy

                      J 1 Reply Last reply 20 Jun 2022, 13:39
                      0
                      • S SPlatten
                        20 Jun 2022, 13:32

                        @jsulm , ok, so how can I fix the tabs in the UI to do what I want? I'm done this without the tabs in the UI but its to be a job to rip it all apart. Right now I need to call setTabBar after all the initialisation has completed with the tabs added, but I cannot all setTTabBar outside of the class as its a protected method.

                        J Offline
                        J Offline
                        JonB
                        wrote on 20 Jun 2022, 13:39 last edited by
                        #18

                        @SPlatten
                        Outside of what class? I really don't know your code. If you need to access a protected method then subclass and you can do what you like?

                        S 1 Reply Last reply 20 Jun 2022, 13:41
                        0
                        • J JonB
                          20 Jun 2022, 13:39

                          @SPlatten
                          Outside of what class? I really don't know your code. If you need to access a protected method then subclass and you can do what you like?

                          S Offline
                          S Offline
                          SPlatten
                          wrote on 20 Jun 2022, 13:41 last edited by
                          #19

                          @JonB , its really not my code, I'm just trying to make it work and failing.

                          Kind Regards,
                          Sy

                          1 Reply Last reply
                          0

                          17/19

                          20 Jun 2022, 13:32

                          • Login

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