Re: [PyQt] Reporting Bugs in PyQt/Qt

2010-11-30 Thread Ian

On 29/11/2010 22:44, Andreas Pakulat wrote:

There are many references to an example which might have helped. This is at
  
  http://www.riverbankcomputing.co.uk/static/Docs/PyQt4/html/itemviews-simpletreemodel.html
  
  This gives a 404.  Double H.

I'd expect the sample to be part of the PyQt4 distribution (at least the
sources).


Hi Andreas, Hans

That would make a lot of sense, but sadly, it is not so.

The Windows distribution includes no examples. When you load the 
examples menu option, you get a warning that tells you they have not 
been installed! The menu system it then loads is showy, and allows you 
to select the examples - which then fail.


Within the API docs, the links to Model/View Classes and model/view 
Framework point to missing files (all links to examples also fail).


The assistant contains just the introduction page and nothing else. (No 
helpful comments about finding it on-line).


And rather worryingly, All the links claim to point to 4.7.4's 
documentation. When you get there,  its all 4.6.


So it would appear some dim-witted moronic fool has removed the first 
tier of helpful docs from the windows release. No wonder things are so 
exasperatingly difficult!


Now that I have found the on-line docs, and I will persist.

Regards

Ian

























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


Re: [PyQt] Reporting Bugs in PyQt/Qt

2010-11-30 Thread Phil Thompson
On Tue, 30 Nov 2010 10:35:03 +, Ian hobso...@gmail.com wrote:
 On 29/11/2010 22:44, Andreas Pakulat wrote:
 There are many references to an example which might have helped. This
 is at
   
  
http://www.riverbankcomputing.co.uk/static/Docs/PyQt4/html/itemviews-simpletreemodel.html
   
   This gives a 404.  Double H.
 I'd expect the sample to be part of the PyQt4 distribution (at least
the
 sources).

 Hi Andreas, Hans
 
 That would make a lot of sense, but sadly, it is not so.

So if you click on PyQt Examples Source in the Start menu you get an
empty directory?

 The Windows distribution includes no examples. When you load the 
 examples menu option, you get a warning that tells you they have not 
 been installed!

I suggest that you read the message more closely - it does not say that
the examples are not installed.

 The menu system it then loads is showy, and allows you 
 to select the examples - which then fail.
 
 Within the API docs, the links to Model/View Classes and model/view 
 Framework point to missing files (all links to examples also fail).

The class reference documentation is automatically generated from the Qt
documentation. The process is by no means perfect and, as it says at the
top of...

http://www.riverbankcomputing.com/static/Docs/PyQt4/html/classes.html

...results in some broken links.

 The assistant contains just the introduction page and nothing else. (No 
 helpful comments about finding it on-line).
 
 And rather worryingly, All the links claim to point to 4.7.4's 
 documentation. When you get there,  its all 4.6.

At the bottom of every page of the class reference it clearly states the
version of PyQt (v4.7.4 in your case) and the version of Qt (v4.6 in your
case).

 So it would appear some dim-witted moronic fool has removed the first 
 tier of helpful docs from the windows release. No wonder things are so 
 exasperatingly difficult!

 Now that I have found the on-line docs, and I will persist.
 
 Regards
 
 Ian

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


[PyQt] Reporting Bugs in PyQt/Qt

2010-11-29 Thread Ian

Hi Everyone

I have four bugs to report. Where should they be reported?

1) The PyQt documentation contains a lot of things like this:  at 
http://www.riverbankcomputing.co.uk/static/Docs/PyQt4/html/qabstractitemview.html#selectionChanged


quote
QAbstractItemView.selectionChanged (self, QItemSelection 
(http://www.riverbankcomputing.co.uk/static/Docs/PyQt4/html/qitemselection.html), 
QItemSelection 
(http://www.riverbankcomputing.co.uk/static/Docs/PyQt4/html/qitemselection.html))


This method is also a Qt slot with the C++ signature void 
selectionChanged(const QItemSelection,const QItemSelection).


This slot is called when the selection is changed. The previous 
selection (which may be empty), is specified by deselected, and the new 
selection by selected.

end quote

I can guess that deselected is one parameter, and selected refers to 
the other.  I cannot tell which is which.


Suggestion - The title should be the Python def line of the method. The 
main text should include a table containing

The parameter name
Its type
if it is optional or mandatory
Its purpose

2) When you call  setSortingEnabled(True)  on a QTreeView the model's 
sort routine is called twice.


No sort is necessary in my use case, because the data is already sorted 
correctly. However I would accept a single sort column 0, ascending.


Besides, sorting should *always* be done in the view and never in the 
model. Sorting is a matter of data presentation. A model may have many 
views - and each could sort in different orders without interfering with 
each other.  The view has the data.


So SortEnable should handle it all - and map the index back, so the data 
in the model need not move. If the view needs to know the domain of a 
column (numeric, string, character set), then it should ask the model.


This bug has been reported since PyQt 4.4 - and is still outstanding.

3) When the bug in 2) has finished sorting the data twice, it results in 
the header icon being in the wrong sense. Clicking the header continues 
to sort the data in the opposite direction to that indicated by the 
icon.  After clicking to another column and clicking back it does 
correct itself.  This only effects column 0.

 -
4) My table has exactly 5 columns of data - 
['Name','Ref','Street','Town','Contacts'].


If I return 5 from columnCount() then I don't get any headers! If I 
return 6 then the headers appear - and include an empty column on the right.


Anyone know a work-round for this?

Regards

Ian

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


Re: [PyQt] Reporting Bugs in PyQt/Qt

2010-11-29 Thread Phil Thompson
On Mon, 29 Nov 2010 12:42:53 +, Ian hobso...@gmail.com wrote:
 Hi Everyone
 
 I have four bugs to report. Where should they be reported?

PyQt bugs should be reported on this mailing list.

Qt bugs should be reported to Nokia.

 1) The PyQt documentation contains a lot of things like this:  at 

http://www.riverbankcomputing.co.uk/static/Docs/PyQt4/html/qabstractitemview.html#selectionChanged
 
 quote
 QAbstractItemView.selectionChanged (self, QItemSelection 

(http://www.riverbankcomputing.co.uk/static/Docs/PyQt4/html/qitemselection.html),
 
 QItemSelection 

(http://www.riverbankcomputing.co.uk/static/Docs/PyQt4/html/qitemselection.html))
 
 This method is also a Qt slot with the C++ signature void 
 selectionChanged(const QItemSelection,const QItemSelection).
 
 This slot is called when the selection is changed. The previous 
 selection (which may be empty), is specified by deselected, and the new 
 selection by selected.
 end quote
 
 I can guess that deselected is one parameter, and selected refers to

 the other.  I cannot tell which is which.
 
 Suggestion - The title should be the Python def line of the method. The 
 main text should include a table containing
  The parameter name
  Its type
  if it is optional or mandatory
  Its purpose

The lack of argument names in the documentation is a bug.

 2) When you call  setSortingEnabled(True)  on a QTreeView the model's 
 sort routine is called twice.
 
 No sort is necessary in my use case, because the data is already sorted 
 correctly. However I would accept a single sort column 0, ascending.
 
 Besides, sorting should *always* be done in the view and never in the 
 model. Sorting is a matter of data presentation. A model may have many 
 views - and each could sort in different orders without interfering with

 each other.  The view has the data.
 
 So SortEnable should handle it all - and map the index back, so the data

 in the model need not move. If the view needs to know the domain of a 
 column (numeric, string, character set), then it should ask the model.
 
 This bug has been reported since PyQt 4.4 - and is still outstanding.

If it's a bug then it's a Qt bug.

 3) When the bug in 2) has finished sorting the data twice, it results in

 the header icon being in the wrong sense. Clicking the header continues 
 to sort the data in the opposite direction to that indicated by the 
 icon.  After clicking to another column and clicking back it does 
 correct itself.  This only effects column 0.

This is Qt.

 4) My table has exactly 5 columns of data - 
 ['Name','Ref','Street','Town','Contacts'].

This is Qt.

 If I return 5 from columnCount() then I don't get any headers! If I 
 return 6 then the headers appear - and include an empty column on the
 right.
 
 Anyone know a work-round for this?
 
 Regards
 
 Ian

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


Re: [PyQt] Reporting Bugs in PyQt/Qt

2010-11-29 Thread Andreas Pakulat
On 29.11.10 12:42:53, Ian wrote:
 2) When you call  setSortingEnabled(True)  on a QTreeView the model's  
 sort routine is called twice.

 No sort is necessary in my use case, because the data is already sorted  
 correctly. However I would accept a single sort column 0, ascending.

 Besides, sorting should *always* be done in the view and never in the  
 model. Sorting is a matter of data presentation. A model may have many  
 views - and each could sort in different orders without interfering with  
 each other.  The view has the data.

 So SortEnable should handle it all - and map the index back, so the data  
 in the model need not move. If the view needs to know the domain of a  
 column (numeric, string, character set), then it should ask the model.

 This bug has been reported since PyQt 4.4 - and is still outstanding.

Of course, reporting it against PyQt doesn't help, you need to report this
to Nokia, unless you can demonstrate that the equivalent C++ code has no
such problem. 

That being said, sorting is supposed to be done through a proxy model these
days, i.e. the view doesn't work on the real model directly.

 3) When the bug in 2) has finished sorting the data twice, it results in  
 the header icon being in the wrong sense. Clicking the header continues  
 to sort the data in the opposite direction to that indicated by the  
 icon.  After clicking to another column and clicking back it does  
 correct itself.  This only effects column 0.

Again sounds like a Qt (or style) bug.

  -
 4) My table has exactly 5 columns of data -  
 ['Name','Ref','Street','Town','Contacts'].

 If I return 5 from columnCount() then I don't get any headers! If I  
 return 6 then the headers appear - and include an empty column on the 
 right.

 Anyone know a work-round for this?

Post a small runnable example that reproduces this, for example by
modifying one of the examples coming with PyQt.

Andreas

-- 
You have an ambitious nature and may make a name for yourself.
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt


Re: [PyQt] Reporting Bugs in PyQt/Qt

2010-11-29 Thread Andreas Pakulat
On 29.11.10 18:44:58, Ian wrote:
 On 29/11/2010 13:09, Andreas Pakulat wrote:
 
 4) My table has exactly 5 columns of data -
 ['Name','Ref','Street','Town','Contacts'].
 
 If I return 5 from columnCount() then I don't get any headers! If I
 return 6 then the headers appear - and include an empty column on the
 right.
 
 Anyone know a work-round for this?
 Post a small runnable example that reproduces this, for example by
 modifying one of the examples coming with PyQt.
 
 Andreas
 
 See http://homepage.ntlworld.com/ian.hobson/demo.py
 
 This demonstrates two of the errors.
 
 After opening, the icon in the first column shows Ascending and a
 click will convert it
 to Descending, leaving the sort in Ascending.  Click away and
 any other column works
 correctly. Click back to first column and it now works correctly.

Can't say anything about this error.

 If you edit line 50/51 as per comments, you can return the correct
 value from columnCount()
 and the headers do not appear (which makes sorting difficult).

But this one is caused because you don't take care of the role parameter
in headerData. If you only return something for Qt.DisplayRole it works.
I can't tell you why this is the case or why it works when adding +1 to
the columnCount. That would need some digging into the itemview code in
Qt.

Andreas

-- 
You will be reincarnated as a toad; and you will be much happier.
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt


Re: [PyQt] Reporting Bugs in PyQt/Qt

2010-11-29 Thread Ian

On 29/11/2010 19:21, Andreas Pakulat wrote:

On 29.11.10 18:44:58, Ian wrote:

On 29/11/2010 13:09, Andreas Pakulat wrote:

4) My table has exactly 5 columns of data -
['Name','Ref','Street','Town','Contacts'].

If I return 5 from columnCount() then I don't get any headers! If I
return 6 then the headers appear - and include an empty column on the
right.

Anyone know a work-round for this?

Post a small runnable example that reproduces this, for example by
modifying one of the examples coming with PyQt.

Andreas


See http://homepage.ntlworld.com/ian.hobson/demo.py

This demonstrates two of the errors.

After opening, the icon in the first column shows Ascending and a
click will convert it
to Descending, leaving the sort in Ascending.  Click away and
any other column works
correctly. Click back to first column and it now works correctly.

Can't say anything about this error.


If you edit line 50/51 as per comments, you can return the correct
value from columnCount()
and the headers do not appear (which makes sorting difficult).

But this one is caused because you don't take care of the role parameter
in headerData. If you only return something for Qt.DisplayRole it works.
I can't tell you why this is the case or why it works when adding +1 to
the columnCount. That would need some digging into the itemview code in
Qt.

Andreas

Hi Andreas,
Thank you for the pointer.

I have just googled and found the documentation that mentions this. It 
is not in the
class I am using, nor in the method I am using, nor is it very clear 
when I find it.


Hmmm.

Having chased down the definition of the role - not in the class or 
method, and not linked from either location -
then it does become a bit clearer. As a noob I had thought that I am 
only displaying, so why does the model

call for anything other than display role?

There are many references to an example which might have helped. This is at

http://www.riverbankcomputing.co.uk/static/Docs/PyQt4/html/itemviews-simpletreemodel.html

This gives a 404.  Double H.

So. In my first week with Python, PyQt and Qt I have:
a) Uncovered more bugs in QT in one week, than I uncovered in all the 
software I used in my first 20 years in IT.


b) Been helped over styles three times twice here - and once in the 
Python list - with information
that was very hard to find if you did not know the exact name you were 
looking for.


Conclusion - super people, shame about the documentation, shame on Qt.

Have I just hit a bad class in QAbstractTableModel - or is all Qt as buggy?

Regards. - And thanks.

Ian











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


Re: [PyQt] Reporting Bugs in PyQt/Qt

2010-11-29 Thread Wolfgang Rohdewald
On Montag 29 November 2010, Ian wrote:
 Having chased down the definition of the role - not in the
 class or  method, and not linked from either location

http://doc.qt.nokia.com/4.7/qabstractitemmodel.html#data
with a note: See also
http://doc.qt.nokia.com/4.7/qt.html#ItemDataRole-enum

there you can read

Each item in the model has a set of data elements associated with
it, each with its own role. The roles are used by the view to
indicate to the model which type of data it needs. Custom models
should return data in these types.

that seems quite clear to me. 

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


Re: [PyQt] Reporting Bugs in PyQt/Qt

2010-11-29 Thread Andreas Pakulat
On 29.11.10 21:05:43, Ian wrote:
 Hi Andreas,
 Thank you for the pointer.
 
 I have just googled and found the documentation that mentions this.
 It is not in the
 class I am using, nor in the method I am using, nor is it very clear
 when I find it.
 
 Hmmm.
 
 Having chased down the definition of the role - not in the class or
 method, and not linked from either location -

You mean you missed the See also in
http://doc.qt.nokia.com/4.5/qabstractitemmodel.html#headerData?

One thing to keep in mind: PyQt is a really thin layer over Qt/C++, so
if the PyQt docs seem lacking, just look it up in the Qt api docs.

 then it does become a bit clearer. As a noob I had thought that I am
 only displaying, so why does the model
 call for anything other than display role?

Because display'ing takes a lot more than just getting a string to
show... And the view doesn't know you're just displaying, it needs to be
ready to also edit, tooltip (which is display too) and size things
properly.

 There are many references to an example which might have helped. This is at
 
 http://www.riverbankcomputing.co.uk/static/Docs/PyQt4/html/itemviews-simpletreemodel.html
 
 This gives a 404.  Double H.

I'd expect the sample to be part of the PyQt4 distribution (at least the
sources).

 So. In my first week with Python, PyQt and Qt I have:
 a) Uncovered more bugs in QT in one week, than I uncovered in all
 the software I used in my first 20 years in IT.
 
 b) Been helped over styles three times twice here - and once in the
 Python list - with information
 that was very hard to find if you did not know the exact name you
 were looking for.

If you think so, talk to Nokia to let them know where to improve the
documentation. Personally I find the Qt api docs a really good
references, I have to deal with a much more crappy stuff on a daily
basis. Same goes to the Qt examples (and the PyQt ones which are mostly
python versions of the C++ ones).

 Conclusion - super people, shame about the documentation, shame on Qt.
 
 Have I just hit a bad class in QAbstractTableModel - or is all Qt as buggy?

So far there's only a single bug in this thread (and I didn't quite
understand your description so I'm not even sure about that) and thats
the sorting-thing. Everything else is not a Qt bug, but bugs in your
code.

Andreas

-- 
Abandon the search for Truth; settle for a good fantasy.
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt