PyQt(Qt): unexpected scrollbars in QCanvasView

Sam Holden sholden at flexal.cs.usyd.edu.au
Sat Aug 14 06:22:56 EDT 2004


On Sat, 14 Aug 2004 09:33:51 GMT, Konrad Koller <koko9991 at compuserve.de> wrote:
> 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.
> Thanks for any help.

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)


-- 
Sam Holden



More information about the Python-list mailing list