Signal for expanding item in QTreeView
-
Hello,
I want to get a signal for clicking on the "+" Button (so when it expands)
!http://i.imagebanana.com/img/6h3ak0b0/treeview_expand.png!
The background is: I have a filetree with only the directories with a fixed width
[code]
model.setRootPath("");
#ifdef Q_OS_MAC
model.setFilter(QDir::Dirs | QDir::NoDotAndDotDot | QDir::Hidden);
#else
model.setFilter(QDir::Dirs | QDir::NoDotAndDotDot);
#endif
dirtree = new QTreeView(this);
dirtree->setModel(&model);
dirtree->setColumnHidden(1,true);
dirtree->setColumnHidden(2,true);
dirtree->setColumnHidden(3,true);
dirtree->setHeaderHidden(true);
dirtree->setAnimated(true);
dirtree->setSortingEnabled(false);
dirtree->setFixedWidth(200);
dirtree->sortByColumn(0,Qt::AscendingOrder);
[/code]When I got deeper and deeper in a tree, the widht of 200px is too low, so I need a horizontal scroll bar at the bottom. I can do that with resizeColumnToContents(0); but I have to find out, when the user expand one of the directories. Can anybody help me?
-
Just take a look into the "documentation":http://qt-project.org/doc/qt-4.8/qtreeview.html#expanded.
-
[quote author="sierdzio" date="1362393335"]Just take a look into the "documentation":http://qt-project.org/doc/qt-4.8/qtreeview.html#expanded.[/quote]
Thank you... I tried it before asking and now, it seems to work :)
Strange... seems to be a mistake on my side :) -
No worries. Good to hear it works now.