Why my TableWidget is not shown in TabWidget?
-
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
-
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