Attachment 375
hi all,
Can some body explain how to implement this tree view.
Thanks in advance,
Seema Rao
Printable View
Attachment 375
hi all,
Can some body explain how to implement this tree view.
Thanks in advance,
Seema Rao
Hi..
Use the QTreeWidget and then QTreeWidgetItem to create it..
With this you can set the image with every tree item and can subclass it in any hierarchy u need..
Kapil
Or QTreeView and a model of your choice.
I tried to create a simple tree view, but no tree appears, Am I doing any thing wrong here??
#include <QApplication>
#include <QtGui>
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
QWidget *widget = new QWidget;
QTreeWidget *treeWidget= new QTreeWidget;
QTreeWidgetItem *cities = new QTreeWidgetItem(treeWidget);
cities->setText(0, "Cities");
QTreeWidgetItem *osloItem = new QTreeWidgetItem(cities);
osloItem->setText(0, "Oslo");
osloItem->setText(1, "Yes");
treeWidget->addTopLevelItem(cities);
QVBoxLayout *mylayout= new QVBoxLayout;
mylayout->addWidget(treeWidget);
widget->setLayout(mylayout);
widget->show();
app.exec();
}
Thanks in advance,
Seema
Add:
after you create the tree widget.Code:
treeWidget->setColumnCount(2);