Important: Please read the Qt Code of Conduct -

[Solved] Display QTableView in QTabWidget or QWidget

  • Hi,
    Kindly help me out with this issue. I have a QTableView object which i display currently using;@

    How will i display this tableview object inside a tab say x within QTabWidget y?

    Please help.

  • Add it to that tab. See QTabWidget docs.

  • I understand i have to add it to the tab, i am not understanding how to do that.

  • Ok, so... I guess docs are not that good. Exactly which parts of QTabWidget docs are unclear in your opinion, so we can explain them to you?

  • Hi Peppe,
    I have created several standalone programs now i have to merge them into one Tab Widget. One of the program was to create a QTableView and i display it using

    Now how do i display this qtableview object in one of the tabs ? I understand i have to probably just add one line which would be something like ui->tab_name-> ???? i am unable to figure this out. How to add the tableview object say x to tab y

    Thanks for helping

  • From the "documentation":
    The normal way to use QTabWidget is to do the following:

    1. Create a QTabWidget.
    2. Create a QWidget for each of the pages in the tab dialog, but do not specify parent widgets for them.
    3. Insert child widgets into the page widget, using layouts to position them as normal.
    4. Call addTab() or insertTab() to put the page widgets into the tab widget, giving each tab a suitable label with an optional keyboard shortcut.


Log in to reply