PyQt(Qt): unexpected scrollbars in QCanvasView

K

Konrad Koller

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.
 
S

Sam Holden

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)
 
K

Konrad Koller

For a card playing game I constructed a layout of 49 playing cards
Sam said:
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,202
Messages
2,571,057
Members
47,667
Latest member
DaniloB294

Latest Threads

Top