开发者

Padding in QScrollArea

开发者 https://www.devze.com 2023-03-02 21:25 出处:网络
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'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:

Padding in QScrollArea

(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?


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(...);
0

精彩评论

暂无评论...
验证码 换一张
取 消