[PyKDE] Re: Bug with QScrollView viewport binding

Giovanni Bajo rasky at develer.com
Wed Jun 29 15:21:44 BST 2005


Phil Thompson <phil at riverbankcomputing.co.uk> wrote:

> Yes - but they aren't in existence at the same time.
> [...]
> Using a temporary name to keep a reference to sv.viewport() solves the
> problem.

Then you have the inverse problem:

----------------------------------------------
from qt import *

app = QApplication([])
sv = QScrollView(None)
w = QWidget(sv.viewport())

p = w.parent()
print sv.viewport().width()
----------------------------------------------
Traceback (most recent call last):
  File "D:\Work\caligola3d\src\pyqtbug3.py", line 9, in ?
    print sv.viewport().width()
AttributeError: width

which is wrong because viewport() is supposed to return a QWidget pointer.

[Yes, the type of that widget is an internal Qt's class]
-- 
Giovanni Bajo




More information about the PyQt mailing list