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. Why my TableWidget is not shown in TabWidget?
Qt 6.11 is out! See what's new in the release blog

Why my TableWidget is not shown in TabWidget?

Scheduled Pinned Locked Moved General and Desktop
2 Posts 2 Posters 1.3k Views 1 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.
  • M Offline
    M Offline
    Macro
    wrote on last edited by
    #1

    Hi...

    I am Creating an Application which uses of Multiple Tabs. I am using a QTableWidget to do it. In Some Tabs, I have to show some Tables in it. So, I Tried adding a QTableWidget in it. But it fails.. :-(

    Here's my Coding.

    @QWidget *wid = qPreviewTab->widget(Index);
    QTableWidget *tableWidget = new QTableWidget();

    QVBoxLayout *vLayout = new QVBoxLayout();
    vLayout->addWidget(tableWidget);
    wid->setLayout(vLayout); @

    But, When I try to add some QPushbuttons, QComboBox, QLabels etc. all are shown in the TabWidget. But I can't able to show only the QTableWidget. Why ? Where I'm going wrong ? Please suggest your views.

    Thanks & Regards

    1 Reply Last reply
    0
    • C Offline
      C Offline
      Code_ReaQtor
      wrote on last edited by
      #2

      I tried your code and modified the first line:

      @QWidget *wid = ui->tabWidget->widget(Index);@

      since I used a form.

      All I can say is there is actually nothing wrong with your code. Did you modify your QTableWidget in any way? e.g. you set its frame style to "NoFrame"? Tried to test it this way since QTabWidget's background color is similar to QTableWidget's.... I am thinking it might have been "camouflaged" since you were saying other widgets worked.

      Edit: You can use QWidget::isVisible to check if your tabwidget is shown

      Please visit my open-source projects at https://github.com/Code-ReaQtor.

      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