Details
-
Bug
-
Resolution: Invalid
-
P4: Low
-
None
-
5.6.3
-
None
Description
Code :
void test()
{ QMainWindow *mw = new QMainWindow(); QTabWidget *tabwidget = new QTabWidget(mw); QLabel *label = new QLabel(mw); tabwidget->insertTab(0, label, "Some title"); QWidget *w = tabwidget->widget(0); qDebug()<<"CLASS NAME :"<<w->parent()->metaObject()->className(); qDebug()<<"OBJECT NAME :"<<w->parent()->objectName(); }expected result :
CLASS NAME : QMainWindow
OBJECT NAME : "mw"
actual result :
CLASS NAME : QStackedWidget
OBJECT NAME : "qt_tabwidget_stackedwidget"
Offical documentation says :
int QTabWidget::insertTab(int index, QWidget* page, const QString & label)
Inserts a tab with the given label and page into the tab widget at the specified index, and returns the index of the inserted tab in the tab bar. Ownership of page is passed on to the QTabWidget.
1. Is 'Ownership of page ' means 'Parentship of page' too?
2. If yes, why QStackedWidget and not QTabWidget ?