[PyQt] Issue with selected cells in a QTableView
pavel at brych.cz
Tue Mar 22 21:05:33 GMT 2011
I thing you are clear enough. When I run your code and tried to
reproduce your problem, I noticed that selection is actually right, only
cells are not repainted to visualize this new selection, because in your
TableView.updateView() method you disconnecting all slots from
selectionChanged signal, not only your trackSelection() slot.
When you update the line to this:
everything seems to work fine.
Dne 22.3.2011 20:50, Vicent Mas napsal(a):
> 2011/3/22 simozack <simozackml at gmail.com>:
>> 2011/3/22 Vicent Mas <uvemas at gmail.com>:
>>> it is explained in my second mail of this thread. Vincent Van de
>>> Vyvre asked exactly the same. If it is not clear enough I can explain
>>> it again. But let me insist, even if my script was purely an academic
>>> exercise, without practical interest, *if it exposes a PyQt4 bug* then
>>> the bug has to be reported. My problem is that I'm not sure if it is a
>>> PyQt4 bug, a Qt4 bug or other thing. Neither I see a workaround that I
>>> can apply to my real code. Although I don't know C++ I've decided to
>>> port the script to that language and see if the problem persists. In
>>> that case I'll report it to Nokia. Writing C++ will be painful for me
>>> :-(, so if someone has more ideas please, tell me.
>> Maybe my poor English does another victim... :)
> Or maybe it is just me.
>> I don't understand why, inside the updateView method, you disconnect
>> and then reconnect the signal "selectionChanged". I think that that
>> signal isn't emitted if the model changed, but only if the user
>> changes the selection.
>> If you don't do that (disconnecting and reconnecting the signal, not
>> launching the updateView) do you have a not so good performarce or
>> what? :)
> Let's see it one more time. One thing is the minimal script attached
> to this thread and other thing is the real code. In the script
> connecting/disconnecting the signal has the only mission of reproduce
> the buggy behavior of the real code. The script would work just fine
> without connecting/disconnecting, that's clear for everybody. The real
> code is different because there the connect/disconnect trick is
> meaningful. Please, note that I'm not saying that
> connecting/disconnecting is the only solution to my problem. As I've
> already said I'm looking for alternatives or workarounds. It is just
> that I've not yet found a clean alternative for solving my problem.
> On the other hand what is clear for me is that even if the attached
> script is absurd, stupid or useless, if I'm suspicious that it
> contains a PyQt4 bug I have to report it here. This is exactly what
> I've done. If Phil see a bug I hope he will fix it (so my real code
> will work as is until I find a better design), if not I simply will
> keep looking for a solution to my problem.
> I hope things are clearer now (if they are not then I'm in trouble :-)
mail: pavel at brych.cz
Jabber: pavel.brych at jabber.cz
MSN: pavel at brych.cz
More information about the PyQt