Please nominate your Qt Champions for 2021!

Cut and paste a QTableWidget

  • First, this is my first project with Qt Designer so I hope someone can help.

    I made good progress with the start of my UI design and I have menu items and a QTableWidget working nicely. However, I need to add more widgets to my UI and I think I need to add a couple of layout widgets. My problem is I tried to "cut" my QTableWidget, place the layout on the center widget and then paste the QTableWidget into one of the layout widgets.

    Qt Designer will not allow me to do this and says I need to "break" the layout before the paste. So, I did the "cut", used the "break" layout button, added a vertical layout, after pasting the QTableWidget I then dragged the QTableWidget into the layout. This appeared to work, however, when I preview the UI and resize it the widgets do not resize with the window as they did before.

    How can I re-enable the auto-resize of the UI?

  • Lifetime Qt Champion

    Hi and welcome to the forums

    About copy a "filled" table widget.

    way 1. One same form ctrl+drag it to create clone

    way 2. Between different forms or projects
    Drag the filled Widget to the left side bar with all the others widget.
    Drop it at the white area below and you get a scratch pad with the widget in.
    Now you can drag this to any layout you wish.
    alt text
    (in the picture i dragged a graphicsView to the empty area )

    Avoid breaking layouts it messes up things and you cant just get it back It must be recreated. :(

Log in to reply