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. Put 2 widgets on top of each other
Qt 6.11 is out! See what's new in the release blog

Put 2 widgets on top of each other

Scheduled Pinned Locked Moved Solved General and Desktop
3 Posts 2 Posters 1.6k 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.
  • G Offline
    G Offline
    GunkutA
    wrote on last edited by
    #1

    Hello I wonder if it is possible to put 2 widgets such as QTableWidget to top of eachother. I want to have 2 TableWidgets and when a button pressed, I want to show other widget and hiding the previous one. For example, button pressed -> Hide first table show second, another button press->show first table and hide the second one. I tried that from the UI but it did not let me put 2 tablewidgets on top of each other. I was thinking putting widget outside of the window then when button pressed, moving the widget to the desired position. But layout does not let me move the widgets by code. Is there a trick I can achieve to have 2 QTableWidgets on each other while one is visible and other one is invisible.

    1 Reply Last reply
    0
    • B Offline
      B Offline
      Bonnie
      wrote on last edited by
      #2

      You can't if you put them into layouts in the designer.
      Why don't you use QStackedWidget for that?

      1 Reply Last reply
      1
      • G Offline
        G Offline
        GunkutA
        wrote on last edited by
        #3

        I did not know something like that exists ^^. I checked that out and it looks like, the widget I choose from the index gets shown in the window. So simply I will put a QStackedWidget in the place of my QTableWidget and then put 2 QTableWidgets in it I believe.

        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