John Chadwick
John Chadwick

Reputation: 3213

Padding in QScrollArea

I'm a bit new to Qt4's way of laying things out and I've ran across a problem when designing the GUI for a simple image editor.

I want to have the QScrollArea contain the component for image editing. However, I want the component itself to be big enough that one can scroll the entire image completely off view (but only exactly off view; no more) in any direction. Here's a (rough) diagram of what I'm thinking:

Illustration of the said widget.

(Apparently, you can't scroll horizontally in this diagram...)

So far I haven't really figured out a way to do this. I tried messing with the widget's sizeHint and other things (like using CSS) and none of them seem to work. What should I be doing instead?

Upvotes: 1

Views: 1104

Answers (1)

Chugaister
Chugaister

Reputation: 364

With QScrollArea::widgetResizable == true property scroll area will try to resize your widget. Set this property to false. Or you can adjust your canvas widget size by

canvasWidget->setFixedSize(...);
               ||
canvasWidget->setMinimumSize(...);

Upvotes: 2

Related Questions