PDA

View Full Version : QTreeWidget in a Dockwidget



LordQt
7th September 2007, 13:15
Hello friends,

after some experiences I´ve make my tree. My target is a dockwidget with a tree like the one in the designers left side. My code is :


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");


Is there any tips for me to make them nearly looks like the designer one´s??

jpn
7th September 2007, 19:23
I think this question has already been answered in thread: http://www.qtcentre.org/forum/f-qt-programming-2/t-the-widget-in-qts-designer-8775.html

LordQt
9th September 2007, 00:22
I think no. Your answer is like "here are the book read self"

I think the philosophie of a forum is another i am not a trolltech men to read the code from the designer
i am just at the beginning thats the reason i make my question for the same point twice.

sorry for not beeing perfect !!!!!!!!!!!!

jpn
9th September 2007, 07:09
Your answer is like "here are the book read self"
So you want me to read a book for you or what? :)


i am just at the beginning thats the reason i make my question for the same point twice.
Do not start new threads on the same subject. Just ask for more details in the original thread, please.