PyQt(Qt): unexpected scrollbars in QCanvasView

Konrad Koller koko9991 at compuserve.de
Thu Aug 19 08:46:30 EDT 2004


>> For a card playing game I constructed a layout of 49 playing cards
>> (size of each: x=71, y=96) which are arranged in a 7X7 matrix side by
>> side. Accordingly the pysical size of the Canvas is x=71*7, y=96*7:
>>
>> in the main program:
>> canvas=QCanvas(497,672)
>>
>> class Board(QCanvasView):
>> 	def __init__(self,canvas,parent):
>> 		QCanvasView.__init__(self,canvas,parent)
>>
>> but QCanvasView produces a layout with scrollbars in both directions.
>> This is very annoying for the player because although the screen's
>> size is more than appropriate for a total layout only some of the
>> cards can be viewed without scrolling. The QScrollView documentation
>> states that as default QScrollView shows a scrollbar when the content
>> is too tall to fit and not else. What goes wrong?
>> I am using PyQt 3.11 and Qt 3.3.1 under Linux.

Sam Holden wrote:
>I would guess it is using the viewable size with the scrollbars to determine
>whether scrollbars are needed, rather than the size without them.
>If you know the scrollbars aren't needed you can manually turn them off:
>	self.setVScrollBarMode(QCanvasView.AlwaysOff)
>	self.setHScrollBarMode(QCanvasView.AlwaysOff)
>
Both scrollbars now have disappeared. All 7 columns can be viewed, but
not all 7 rows. This remains as an unexpected problem.
Konrad Koller



More information about the Python-list mailing list