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. Custom TableView inside .ui file doesnt work/gets called

Custom TableView inside .ui file doesnt work/gets called

Scheduled Pinned Locked Moved Unsolved General and Desktop
12 Posts 3 Posters 755 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.
  • V Offline
    V Offline
    VogelPapaFinn
    wrote on last edited by
    #1

    Hey guys!

    I have a UserSite that is stored in a .ui file. This ui files gets loaded in a .cpp file from the UiLoader. In this .ui file is a "promoted" custom QTableWidget 'TableWidget'. But this doesnt work. When I load the .ui file and display it the default QTableView shows up. I searched for over an hour now but cant find the issue. Because the error could be anywhere Ill give you a link to the github repo. Its not a big project and the only dependency (spdlog) is already included. You only need to build it with CMake.
    Thank you for your help :)

    https://github.com/VogelPapaFinn/FaroBT/tree/master

    1 Reply Last reply
    0
    • Christian EhrlicherC Online
      Christian EhrlicherC Online
      Christian Ehrlicher
      Lifetime Qt Champion
      wrote on last edited by
      #2

      I would guess you will need the designer plugin so QUILoader can create your custom widget. See also QUILoader::addPluginPath()

      Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
      Visit the Qt Academy at https://academy.qt.io/catalog

      V 1 Reply Last reply
      0
      • Christian EhrlicherC Christian Ehrlicher

        I would guess you will need the designer plugin so QUILoader can create your custom widget. See also QUILoader::addPluginPath()

        V Offline
        V Offline
        VogelPapaFinn
        wrote on last edited by
        #3

        @Christian-Ehrlicher If I understand this its to display it in the Qt Designer, right?
        If so this is nat what I want to do. Im talking about runtime. At runtime the wrong/standard QTabelView is called.

        Christian EhrlicherC 1 Reply Last reply
        0
        • V VogelPapaFinn

          @Christian-Ehrlicher If I understand this its to display it in the Qt Designer, right?
          If so this is nat what I want to do. Im talking about runtime. At runtime the wrong/standard QTabelView is called.

          Christian EhrlicherC Online
          Christian EhrlicherC Online
          Christian Ehrlicher
          Lifetime Qt Champion
          wrote on last edited by
          #4

          @VogelPapaFinn said in Custom TableView inside .ui file doesnt work/gets called:

          If I understand this its to display it in the Qt Designer, right?

          I would guess you will need the designer plugin so QUILoader can create your custom widget.

          You said you're using the QUILoader at runtime, I told you that the QUILoader probably needs the designer plugin so it can create the widget.

          Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
          Visit the Qt Academy at https://academy.qt.io/catalog

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

            Hi,

            As @Christian-Ehrlicher wrote, you need the plugin to load your custom widget. See QUiLoader::addPluginPath.

            The code you linked does not contain any call to QUiLoader though.

            That said, do you really need QUiLoader rather than compiling the ui forms ?

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

            V 2 Replies Last reply
            0
            • SGaistS SGaist

              Hi,

              As @Christian-Ehrlicher wrote, you need the plugin to load your custom widget. See QUiLoader::addPluginPath.

              The code you linked does not contain any call to QUiLoader though.

              That said, do you really need QUiLoader rather than compiling the ui forms ?

              V Offline
              V Offline
              VogelPapaFinn
              wrote on last edited by VogelPapaFinn
              #6

              Oh then I missunserstood sorry for that! Ill give that a try.
              @SGaist the src/UserSite.cpp contains a QUiLoader in the constructor.

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

                My bad, it's the one file I missed and the GitHub search did not return any hit.

                Anyway, before building a plugin, do you really have the need for using the loader VS compiling everything ?

                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
                0
                • SGaistS SGaist

                  Hi,

                  As @Christian-Ehrlicher wrote, you need the plugin to load your custom widget. See QUiLoader::addPluginPath.

                  The code you linked does not contain any call to QUiLoader though.

                  That said, do you really need QUiLoader rather than compiling the ui forms ?

                  V Offline
                  V Offline
                  VogelPapaFinn
                  wrote on last edited by
                  #8

                  @SGaist what I forgot: I think I need to load it, yes. I have a main .ui file that has a stacked widget. This represents different sites. I create different .ui files that represent these sites and get loaded at runtime.

                  Christian EhrlicherC 1 Reply Last reply
                  0
                  • V VogelPapaFinn

                    @SGaist what I forgot: I think I need to load it, yes. I have a main .ui file that has a stacked widget. This represents different sites. I create different .ui files that represent these sites and get loaded at runtime.

                    Christian EhrlicherC Online
                    Christian EhrlicherC Online
                    Christian Ehrlicher
                    Lifetime Qt Champion
                    wrote on last edited by
                    #9

                    But why do you need to load them at runtime? I don't see a need for it.

                    Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
                    Visit the Qt Academy at https://academy.qt.io/catalog

                    V 1 Reply Last reply
                    0
                    • Christian EhrlicherC Christian Ehrlicher

                      But why do you need to load them at runtime? I don't see a need for it.

                      V Offline
                      V Offline
                      VogelPapaFinn
                      wrote on last edited by
                      #10

                      @Christian-Ehrlicher what would you do? Im quite new to Qt so Im open to new techniques/ideas etc. :)

                      // this 10 minute post cooldown sucks :|

                      1 Reply Last reply
                      0
                      • Christian EhrlicherC Online
                        Christian EhrlicherC Online
                        Christian Ehrlicher
                        Lifetime Qt Champion
                        wrote on last edited by
                        #11

                        Simply create the widgets normally and add those to your stackedwidget if you don't want to add everything into one ui file.

                        Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
                        Visit the Qt Academy at https://academy.qt.io/catalog

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

                          Simply use them as any other widgets.

                          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
                          0

                          • Login

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