Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt Creator and other tools
  4. Qt Creator: copy and paste widgets why is it so hard

Qt Creator: copy and paste widgets why is it so hard

Scheduled Pinned Locked Moved Unsolved Qt Creator and other tools
9 Posts 4 Posters 1.4k Views
  • 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.
  • E Offline
    E Offline
    egorski
    wrote on last edited by
    #1

    Like in https://forum.qt.io/topic/69525/copying-combo-box-items-in-qt-designer

    Why it is such a hassle to duplicate a button or such?

    I have a widget X, in it button A. Copy button A, paste it into widget X... and no, error: "Cannot paste widgets. Designer could not find a container without a layout to paste into".

    So I have to break layout of X, paste into X, then set layout of X back to what it was? Why can't QtCreator do that on it's own?
    Also, on two steps it sends me back to top of the widgets tree list (if it is a long list especially) which is annoying as you need to find back where you were in the list...

    JonBJ 2 Replies Last reply
    0
    • Christian EhrlicherC Offline
      Christian EhrlicherC Offline
      Christian Ehrlicher
      Lifetime Qt Champion
      wrote on last edited by
      #2

      @egorski said in Qt Creator: copy and paste widgets why is it so hard:

      Why can't QtCreator do that on it's own?

      Where exactly in the layout should the Qt designer put the copied widget into? Random place?

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

      E 1 Reply Last reply
      0
      • E egorski

        Like in https://forum.qt.io/topic/69525/copying-combo-box-items-in-qt-designer

        Why it is such a hassle to duplicate a button or such?

        I have a widget X, in it button A. Copy button A, paste it into widget X... and no, error: "Cannot paste widgets. Designer could not find a container without a layout to paste into".

        So I have to break layout of X, paste into X, then set layout of X back to what it was? Why can't QtCreator do that on it's own?
        Also, on two steps it sends me back to top of the widgets tree list (if it is a long list especially) which is annoying as you need to find back where you were in the list...

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

        @egorski said in Qt Creator: copy and paste widgets why is it so hard:

        So I have to break layout of X, paste into X, then set layout of X back to what it was?

        You can do easier than that, I believe. Calling @mrjj. He showed me how to do something about copy a widget via getting it into a list over at the left-hand side categories, and then I could drag it back as many tines as wanted. IIRC that let me copy widgets, hope I'm not wrong, he should come along and clarify :)

        1 Reply Last reply
        0
        • Christian EhrlicherC Christian Ehrlicher

          @egorski said in Qt Creator: copy and paste widgets why is it so hard:

          Why can't QtCreator do that on it's own?

          Where exactly in the layout should the Qt designer put the copied widget into? Random place?

          E Offline
          E Offline
          egorski
          wrote on last edited by egorski
          #4

          @Christian-Ehrlicher said in Qt Creator: copy and paste widgets why is it so hard:

          Where exactly in the layout should the Qt designer put the copied widget into? Random place?

          Yes.

          Putting it in any position (e.g. at any sort order when placing in Vertical/Horizontal/table layout, or any x,y inside the parent to which I paste it).

          Then I can easily move it to proper place.

          Or a bit better: put it always as last element - and possibly give user an small combo-box to configure where elements are pasted into: first, last, or ask.

          Then I have to only drag it once, now I have to break, unbreak, scroll the widgets view twice, and still put it to proper sorting order too.

          JonBJ Christian EhrlicherC 2 Replies Last reply
          0
          • E egorski

            @Christian-Ehrlicher said in Qt Creator: copy and paste widgets why is it so hard:

            Where exactly in the layout should the Qt designer put the copied widget into? Random place?

            Yes.

            Putting it in any position (e.g. at any sort order when placing in Vertical/Horizontal/table layout, or any x,y inside the parent to which I paste it).

            Then I can easily move it to proper place.

            Or a bit better: put it always as last element - and possibly give user an small combo-box to configure where elements are pasted into: first, last, or ask.

            Then I have to only drag it once, now I have to break, unbreak, scroll the widgets view twice, and still put it to proper sorting order too.

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

            @egorski said in Qt Creator: copy and paste widgets why is it so hard:

            Then I have to only drag it once, now I have to break, unbreak, scroll the widgets view twice, and still put it to proper sorting order too.

            ...which is why we need @mrjj to remind you/me what he showed me to avoid this...

            1 Reply Last reply
            0
            • E egorski

              @Christian-Ehrlicher said in Qt Creator: copy and paste widgets why is it so hard:

              Where exactly in the layout should the Qt designer put the copied widget into? Random place?

              Yes.

              Putting it in any position (e.g. at any sort order when placing in Vertical/Horizontal/table layout, or any x,y inside the parent to which I paste it).

              Then I can easily move it to proper place.

              Or a bit better: put it always as last element - and possibly give user an small combo-box to configure where elements are pasted into: first, last, or ask.

              Then I have to only drag it once, now I have to break, unbreak, scroll the widgets view twice, and still put it to proper sorting order too.

              Christian EhrlicherC Offline
              Christian EhrlicherC Offline
              Christian Ehrlicher
              Lifetime Qt Champion
              wrote on last edited by
              #6

              @egorski said in Qt Creator: copy and paste widgets why is it so hard:

              Yes.

              Feel free to provide a patch :)

              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
              • E egorski

                Like in https://forum.qt.io/topic/69525/copying-combo-box-items-in-qt-designer

                Why it is such a hassle to duplicate a button or such?

                I have a widget X, in it button A. Copy button A, paste it into widget X... and no, error: "Cannot paste widgets. Designer could not find a container without a layout to paste into".

                So I have to break layout of X, paste into X, then set layout of X back to what it was? Why can't QtCreator do that on it's own?
                Also, on two steps it sends me back to top of the widgets tree list (if it is a long list especially) which is annoying as you need to find back where you were in the list...

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

                @egorski
                Since for unknown reasons @mrjj did not come visit this thread to comment, I went off to remind myself how to do this in Qt Creator.

                You can copy & paste an existing widget, with its settings, in Designer. Despite the error message telling you you have to break & reform layout, but it's not obvious.

                1. Design your widget, set its size, properties etc..
                2. Drag it over to the left-hand list of existing widgets, and drop it onto an empty space there.
                3. At this point that list changes to have a new Scratchpad category at the bottom of the list.
                4. That category contains your widget, with its name.
                5. You can now drag that widget onto your design area as many times as you wish, creating a copy each time, with its properties.

                So it may not be obviously documented, but this is a canvenient way to copy & paste your widgets without messing with the existing layout.

                J.HilkJ 1 Reply Last reply
                2
                • JonBJ JonB

                  @egorski
                  Since for unknown reasons @mrjj did not come visit this thread to comment, I went off to remind myself how to do this in Qt Creator.

                  You can copy & paste an existing widget, with its settings, in Designer. Despite the error message telling you you have to break & reform layout, but it's not obvious.

                  1. Design your widget, set its size, properties etc..
                  2. Drag it over to the left-hand list of existing widgets, and drop it onto an empty space there.
                  3. At this point that list changes to have a new Scratchpad category at the bottom of the list.
                  4. That category contains your widget, with its name.
                  5. You can now drag that widget onto your design area as many times as you wish, creating a copy each time, with its properties.

                  So it may not be obviously documented, but this is a canvenient way to copy & paste your widgets without messing with the existing layout.

                  J.HilkJ Online
                  J.HilkJ Online
                  J.Hilk
                  Moderators
                  wrote on last edited by
                  #8

                  @JonB That is indeed convenient, and hod I known this was a thing, I probably would still be using Designer for most stuff, instead of doing it by hand.

                  Well, it helped developing my inner-eye visualisation skills :P


                  Be aware of the Qt Code of Conduct, when posting : https://forum.qt.io/topic/113070/qt-code-of-conduct


                  Q: What's that?
                  A: It's blue light.
                  Q: What does it do?
                  A: It turns blue.

                  JonBJ 1 Reply Last reply
                  0
                  • J.HilkJ J.Hilk

                    @JonB That is indeed convenient, and hod I known this was a thing, I probably would still be using Designer for most stuff, instead of doing it by hand.

                    Well, it helped developing my inner-eye visualisation skills :P

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

                    @J-Hilk
                    I agree whole-heartedly!

                    I too found it a pain that Designer does not allow copy/paste of widgets, despite @Christian-Ehrlicher's objections. For example, Visual Studio certainly does. (I don't recall whether it places the paste randomly, or it may attach an outline of the pasted control to the mouse cursor for you to put wherever you want.) This is not an uncommon feature to want!

                    As I said earlier, I did not know about this Qt Designer Scratchpad feature until @mrjj showed me once. It may not be obvious or even elegant, but it sure is useful!

                    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