Re: [PyQt] Issue with selected cells in a QTableView

2011-03-22 Thread simozack
*Sorry, I answered with a private e-mail*

2011/3/17 Vicent Mas uve...@gmail.com:

 can somebody help me with this problem, please? I've spent several
 days thinking about it but I still don't know if it is a bug (as I
 believe) or not and I have not a fix, not even a workaround.

Hi Vincent,

It works fine if in the updateView() method you don't disconnect and
reconnect the selectionChanged signal (try to comment the first and
the last line of the method).

But I don't understand what you are trying to do with that. Can you
explain, please? :)

HTH,
Simone
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt


Re: [PyQt] Issue with selected cells in a QTableView

2011-03-22 Thread Vicent Mas
2011/3/22 simozack simozac...@gmail.com:
 *Sorry, I answered with a private e-mail*

 2011/3/17 Vicent Mas uve...@gmail.com:

 can somebody help me with this problem, please? I've spent several
 days thinking about it but I still don't know if it is a bug (as I
 believe) or not and I have not a fix, not even a workaround.

 Hi Vincent,

 It works fine if in the updateView() method you don't disconnect and
 reconnect the selectionChanged signal (try to comment the first and
 the last line of the method).

 But I don't understand what you are trying to do with that. Can you
 explain, please? :)

 HTH,
 Simone
 ___
 PyQt mailing list    PyQt@riverbankcomputing.com
 http://www.riverbankcomputing.com/mailman/listinfo/pyqt


Hi,

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.


Vicent


-- 
Share what you know, learn what you don't.
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt


Re: [PyQt] Issue with selected cells in a QTableView

2011-03-22 Thread simozack
2011/3/22 Vicent Mas uve...@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... :)

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? :)

Ciao,
Simone
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt


Re: [PyQt] Issue with selected cells in a QTableView

2011-03-22 Thread Vicent Mas
2011/3/22 simozack simozac...@gmail.com:
 2011/3/22 Vicent Mas uve...@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 :-)

Vicent

-- 
Share what you know, learn what you don't.
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt


Re: [PyQt] Issue with selected cells in a QTableView

2011-03-22 Thread Pavel Brych
Hi Vicent,

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:

self.selection_model.selectionChanged.disconnect(self.trackSelection)

everything seems to work fine.

Pavel Brych

Dne 22.3.2011 20:50, Vicent Mas napsal(a):
 2011/3/22 simozack simozac...@gmail.com:
 2011/3/22 Vicent Mas uve...@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 :-)
 
 Vicent
 

-- 
Pavel Brych
=
tel:721116063
mail:   pa...@brych.cz
ICQ:304482700
Jabber: pavel.br...@jabber.cz
Skype:  pavel.brych
MSN:pa...@brych.cz
WWW:http://brych.cz
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt


Re: [PyQt] Issue with selected cells in a QTableView

2011-03-22 Thread Hans-Peter Jansen
On Tuesday 22 March 2011, 20:50:18 Vicent Mas wrote:
 2011/3/22 simozack simozac...@gmail.com:
  2011/3/22 Vicent Mas uve...@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.

Vicent, have you tried signal blocking/unblocking? Connecting/
disconnecting signals does a lot of churn behind the scenes..

Pete
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt


Re: [PyQt] Issue with selected cells in a QTableView

2011-03-22 Thread Vicent Mas
On 2011-03-22 Hans-Peter Jansen h...@urpla.net said:

 On Tuesday 22 March 2011, 20:50:18 Vicent Mas wrote:
  2011/3/22 simozack simozac...@gmail.com:
   2011/3/22 Vicent Mas uve...@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.
 
 Vicent, have you tried signal blocking/unblocking? Connecting/
 disconnecting signals does a lot of churn behind the scenes..
 
 Pete

Hi,

first of all, thanks to Pavel and Pete.

Pavel, I didn't realise I've disconnected everything from the signal not only 
the trackSelection slot. It fixes things in the script. I'll check if it do the 
same in the real code.

Pete, yes I was considering blocking/unblocking since a few minutes ago. I've 
never used it so I suppose that is why it has taken to me so long to consider 
this possibility.

Once again thanks to both of you (and to other contributors to this thread, of 
course).

Vicent

::

Share what you know, learn what you don't



signature.asc
Description: This is a digitally signed message part.
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt

Re: [PyQt] Issue with selected cells in a QTableView

2011-03-17 Thread Vicent Mas
2011/3/11 Vicent Mas uve...@gmail.com:

 Hi,

 Your code works fine without the function 'updateView(self, *value):'

 Is it necessary to use it and why ?


 Sure it works fine without that method. But the script is just a
 simplified code that shows a problem present in a larger and more
 complex code in which that method is required.

 In the real code I use table models for displaying datasets with
 several thousand millions of rows (the number of rows can be a 64bits
 integer). As I can't load such large datasets in memory at once I've
 to use buffers and table models with dimensions much smaller than
 dimensions of the real dataset. Obviously that means that I have to
 refresh the data of the table model when I move upward and downward
 the dataset. This is why I need an updateView method. Suppose that my
 table model (which has let say 2000 rows) contains the first 2000 rows
 of a dataset with 2 rows and I've selected the cell (100, 0). If I
 move downward and I reache the row 5000 of my dataset the whole data
 and the selection status of the table model have to be refreshed. Now
 the cell (100, 0) of the table model shouldn't be selected. But If I
 go back to the first 2000 rows of the dataset then the cell (100, 0)
 should be selected again.

 And anyway, even if the attached script was a crazycode that I have
 written just for pleasure, if it shows a bug then the bug has to be
 reported, right?

 Hope thinks are clearer now,

 Vicent


Hi all,

can somebody help me with this problem, please? I've spent several
days thinking about it but I still don't know if it is a bug (as I
believe) or not and I have not a fix, not even a workaround.

Your help will be appreciate,

TIA

Vicent
-- 
Share what you know, learn what you don't.
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt