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 duplicate widget
Forum Updated to NodeBB v4.3 + New Features

how to duplicate widget

Scheduled Pinned Locked Moved Solved General and Desktop
18 Posts 9 Posters 20.4k Views 5 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.
  • W wabisuke2718

    @jsulm Could you please tell me a little more?

    jsulmJ Offline
    jsulmJ Offline
    jsulm
    Lifetime Qt Champion
    wrote on last edited by
    #7

    @wabisuke2718 What exactly?

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

    W 1 Reply Last reply
    0
    • jsulmJ jsulm

      @wabisuke2718 What exactly?

      W Offline
      W Offline
      wabisuke2718
      wrote on last edited by
      #8

      @jsulm

      and then create as many instances of this widget as you need.

      Specifically, what kind of code will create widgets?
      I am sorry for troubling you, please tell me.

      jsulmJ 1 Reply Last reply
      0
      • W wabisuke2718

        @jsulm

        and then create as many instances of this widget as you need.

        Specifically, what kind of code will create widgets?
        I am sorry for troubling you, please tell me.

        jsulmJ Offline
        jsulmJ Offline
        jsulm
        Lifetime Qt Champion
        wrote on last edited by
        #9

        @wabisuke2718 A widget is just a C++ class so you create an instance as any other:

        MyWidget *widget = new MyWidget(parent);
        

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

        1 Reply Last reply
        0
        • K Offline
          K Offline
          kenchan
          wrote on last edited by
          #10

          @wabisuke2718
          You can always take a look in the .ui file which QDesigner will generate. You can see how it builds the widgets in code and adapt the code in your own coded widget if you want to.

          1 Reply Last reply
          0
          • mrjjM Offline
            mrjjM Offline
            mrjj
            Lifetime Qt Champion
            wrote on last edited by
            #11
            • So is there no way to duplicate complex QFrames like the next image created in design mode at run time?

            Hi, what ever u draw in Designer also exists as code.
            If you go to the form and look int SetupUI() function, you will see
            all the code that creates such a Frame.

            You can then easy make it a function and just call that to create more of them.
            Copy code to other file as the ui_xx file is generated.

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

              Hi,

              Is this widget meant to show each entry listed in your mastodon feed ?

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

              W 1 Reply Last reply
              0
              • SGaistS SGaist

                Hi,

                Is this widget meant to show each entry listed in your mastodon feed ?

                W Offline
                W Offline
                wabisuke2718
                wrote on last edited by
                #13

                @SGaist yes

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

                  In that case, it will likely make more sense to use a QListView with a custom QStyledItemDelegate and a custom model to hold your data. Otherwise you'll end up with thousands of widgets which is not the best performance-wise for showing a list with basically static content.

                  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
                  • mrjjM mrjj
                    • So is there no way to duplicate complex QFrames like the next image created in design mode at run time?

                    Hi, what ever u draw in Designer also exists as code.
                    If you go to the form and look int SetupUI() function, you will see
                    all the code that creates such a Frame.

                    You can then easy make it a function and just call that to create more of them.
                    Copy code to other file as the ui_xx file is generated.

                    Ayush92A Offline
                    Ayush92A Offline
                    Ayush92
                    wrote on last edited by Ayush92
                    #15

                    @mrjj That is a good idea.Please tell me how we can change duplicate ui_x.h and ui_y.h files at run time for two UI of same class?

                    Pl45m4P Ayush92A 2 Replies Last reply
                    0
                    • Ayush92A Ayush92

                      @mrjj That is a good idea.Please tell me how we can change duplicate ui_x.h and ui_y.h files at run time for two UI of same class?

                      Pl45m4P Offline
                      Pl45m4P Offline
                      Pl45m4
                      wrote on last edited by
                      #16

                      @Ayush92

                      Why you need to do that?
                      Just create multiple instances of the same class?!


                      If debugging is the process of removing software bugs, then programming must be the process of putting them in.

                      ~E. W. Dijkstra

                      1 Reply Last reply
                      1
                      • Ayush92A Ayush92

                        @mrjj That is a good idea.Please tell me how we can change duplicate ui_x.h and ui_y.h files at run time for two UI of same class?

                        Ayush92A Offline
                        Ayush92A Offline
                        Ayush92
                        wrote on last edited by
                        #17

                        My agenda is this [https://stackoverflow.com/questions/64370459/want-to-change-orientation-from-landscape-to-portrait-view-of-qt-c-application?noredirect=1#comment113829091_64370459].

                        JonBJ 1 Reply Last reply
                        0
                        • Ayush92A Ayush92

                          My agenda is this [https://stackoverflow.com/questions/64370459/want-to-change-orientation-from-landscape-to-portrait-view-of-qt-c-application?noredirect=1#comment113829091_64370459].

                          JonBJ Offline
                          JonBJ Offline
                          JonB
                          wrote on last edited by JonB
                          #18

                          @Ayush92
                          For anyone reading this/tempted to answer, please note that the OP is asking the same question in https://forum.qt.io/topic/119689/gui-from-xml-in-c [where I have tried to answer]. We don't want to keep answering the same issues in multiple threads....

                          1 Reply Last reply
                          1

                          • Login

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