docktree->minimumHeight();
docktree->setAutoFillBackground(true);
docktree->setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea);
testTree->setColumnCount(1);
headerLabels << "Label";
testTree->setHeaderLabels(headerLabels);
item[0]->setText(0, "Node-One");
for (int i=1; i< 5; ++i)
item[1]->setText(0, "a");
item[2]->setText(0, "b");
item[3]->setText(0, "c");
item[4]->setText(0, "d");
item[5]->setText(0, "Node-Two");
for (int i=6; i< 10; ++i)
item[6]->setText(0, "a");
item[7]->setText(0, "b");
item[8]->setText(0, "c");
item[9]->setText(0, "d");
QDockWidget *docktree = new QDockWidget(tr("MyTestTree"), this);
docktree->minimumHeight();
docktree->setAutoFillBackground(true);
docktree->setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea);
QTreeWidget *testTree = new QTreeWidget(docktree);
testTree->setColumnCount(1);
QStringList headerLabels;
headerLabels << "Label";
testTree->setHeaderLabels(headerLabels);
QTreeWidgetItem* item[10];
item[0] = new QTreeWidgetItem(testTree);
item[0]->setText(0, "Node-One");
for (int i=1; i< 5; ++i)
item[i] = new QTreeWidgetItem(item[0]);
item[1]->setText(0, "a");
item[2]->setText(0, "b");
item[3]->setText(0, "c");
item[4]->setText(0, "d");
item[5] = new QTreeWidgetItem(testTree);
item[5]->setText(0, "Node-Two");
for (int i=6; i< 10; ++i)
item[i] = new QTreeWidgetItem(item[5]);
item[6]->setText(0, "a");
item[7]->setText(0, "b");
item[8]->setText(0, "c");
item[9]->setText(0, "d");
To copy to clipboard, switch view to plain text mode
Bookmarks