QTreeView with blue line cursor at init
David Boddie <david <at> boddie.org.uk>
2011-06-02 20:22:45 GMT
On Wed, 1 Jun 2011 10:46:42 -0700, emmanuel_mayssat wrote:
> I have an application that run a sequence of tasks listed in a treeview.
> There is a run button.
> When the run button is pressed, it executes all the task in the subtree.
> Now, when the application open, it is not really clear what the run button
> would execute, because the line cursor in the qtreeview is not dispalyed.
> Is there a way to show it by default?
> (The only way I am found after startup of the application is to select a
> node in the tree. but this is one click too many !)
You need to set the current item in the treeview. If you are using
QTreeWidget, you can use its setCurrentItem() method.
If you are using QTreeView, you need to access its selection model via its
selectionModel() method and call the model's setCurrentIndex() method with
a model index.
I think that should do what you want. If it doesn't, please let us know.