[PyQt] Easy Question - How to use selectionChanged on a QTreeView?
Richie Ward
richies at gmail.com
Sun Nov 20 23:06:11 GMT 2016
Thanks, that solved my problem! I didn't think of trying that.
On 20 November 2016 at 22:33, Florian Bruhin <me at the-compiler.org> wrote:
> * Richie Ward <richies at gmail.com> [2016-11-20 22:27:13 +0000]:
>> As I understand it, I have to use
>> setSelectionModel(MySelectionModel()) and subclass
>> QItemSelectionModel. I can then override selectionChanged. My attempts
>> to do this have resulted in this error:
>> QAbstractItemView::setSelectionModel() failed: Trying to set a
>> selection model, which works on a different model than the view.
>
> That's a signal, so you should be able to simply do:
>
> view.selectionModel().selectionChanged.connect(selection_changed)
>
> And then handle it in there, without subclassing anything.
>
> Florian
>
> --
> http://www.the-compiler.org | me at the-compiler.org (Mail/XMPP)
> GPG: 916E B0C8 FD55 A072 | http://the-compiler.org/pubkey.asc
> I love long mails! | http://email.is-not-s.ms/
>
> _______________________________________________
> PyQt mailing list PyQt at riverbankcomputing.com
> https://www.riverbankcomputing.com/mailman/listinfo/pyqt
--
Thanks, Richie Ward
https://uk.linkedin.com/in/richie-ward-07ab0495
More information about the PyQt
mailing list