Hello
I used setChildIndicatorPolicy(QTreeWidgetItem:ontShowIndicator) in a node of a QWidgetTree (not in the root) because my target is not showing the indicator but of course i want to keep the possibility to expand, in order to see the children. This seems to be not possible.
Here is my code:
QTreeWidget *mytreeWidget = new(QTreeWidget);
mytreeWidget->setAutoFillBackground(false);
mytreeWidget->setColumnCount(1);
mytreeWidget->setColumnWidth(0, 100);
mytreeWidget->setIconSize(QSize(48,48));
mytreeWidget->setSelectionMode(QAbstractItemView::NoSelection );
mytreeWidget->setFocusPolicy(Qt::NoFocus);
mytreeWidget->setRootIsDecorated(false);
QTreeWidgetItem *myitem = new (QTreeWidgetItem);
myitem->setSizeHint(0,mySize);
myitem->setIcon( 0, QPixmap::fromImage( QImage(":/resources/NO_GO1.png") ) );
myitem->setText(0,"PADRE");
QTreeWidgetItem *myitem1 = new (QTreeWidgetItem);
myitem1->setSizeHint(0,mySize);
myitem1->setIcon( 0,myIcon);
myitem1->setText(0,"FIGLIO");
QTreeWidgetItem *myitem2 = new (QTreeWidgetItem);
myitem2->setSizeHint(0,mySize);
myitem2->setIcon( 0,QPixmap::fromImage(myImage));
myitem2->setText(0,"FIGLIO");
myitem2->setChildIndicatorPolicy(QTreeWidgetItem:ontShowIndicator);
QTreeWidgetItem *myitem3 = new (QTreeWidgetItem);
myitem3->setSizeHint(0,mySize);
myitem3->setIcon( 0,QPixmap::fromImage( QImage(":/resources/DEG.png") ) );
myitem3->setText(0,"FIGLIO");
myitem2->addChild(myitem3);
myitem->addChild(myitem1);
myitem->addChild(myitem2);
mytreeWidget->addTopLevelItem(myitem);
With this code myitem2 doesn't show correctly the indicator as i desired but is no more possible to expande/collapse.
I'm using QT Creatore 3.2.1 based on Qt 5.3.2. on Linux
On the net i've found out this closed thread similar to mine:
https://forum.qt.io/topic/9691/meet-...tshowindicator
But i couldn't open the referenced link nor i was able to subclass QWindowsStyle class that apparently does not exist in my environment.
Thanks in advance for your support
Bookmarks