[Interest] Catching selection in QTreeView

Andreas Pakulat apaku at gmx.de
Tue Jun 19 08:40:28 CEST 2012


Hi,

On Tue, Jun 19, 2012 at 8:32 AM, Waitman Gobble <uzimac at da3m0n8t3r.com>wrote:

>
> Hi,
>
> I am having an issue with the QTreeView and Key Bindings. It seems when
> the selection changes from a keyboard event, it does not fire the function
> bound to the signal. The mouse button causes the function to run as
> desired. Perhaps I'm missing a setting in the documentation?
>

Are you expecting your "changeCurrent" slot to be called when navigating
the tree with keyboard? If so, thats where your error is. You connected the
pressed-signal of the treeview to that slot and the documentation clearly
states that this signal is emitted when a mouse button is pressed. If you
want to catch selection changes of your tree, you should look at the
signals of the QItemSelectionModel class. You can obtain the
selection-model from the treeview using the selectionModel member functions

Andreas
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20120619/61ba8221/attachment.html>


More information about the Interest mailing list