Re: QScrollArea and resizing
Re: QScrollArea and resizing
...is already true...
I assume that there is a conflict between the qscrollarea trying to fill up the space in the outer widget and resizing to the inner widgets' size, but I don't really know how to resolve this...
Re: QScrollArea and resizing
Can you post a screenshot? Please make sure the boundaries of the inner widget are visible.
Re: QScrollArea and resizing
http://wurstcaptures.untergrund.net/Unbenannt.png
first/upper picture shows the original state. the "timelinish" widget inside the scrollarea is the inner widget mentioned. when I resize the whole window, the inner widget grows with the scrollarea (see second picture). When I use the spinbox to change the displayed duration of the timeline, the inner widget calls "update()" for itself, which repaints the widget.
I actually made it rescale to a smaller size when you change the window size
Code:
QSize QtTimeLine
::sizeHint() const {
return QSize(frames
* zoom
+ 2,
40);
}
to
Code:
QSize QtTimeLine
::sizeHint() const {
return QSize(frames
* zoom
/*+ 2*/,
40);
}
But I can't get it to rescale when I change the size internally...
I'm a bit confused here :o
Re: QScrollArea and resizing
Please don't use external sites to host images you use in your posts. Use the attachment feature of the forum instead.
In what way you change the size "internally"? Do you inform Qt that the sizeHint changes by calling QWidget::updateGeometry()?
Re: QScrollArea and resizing
Ok. Sorry for the external link.
I change the member variables I keep internally which makes "sizeHint()" return a different value... In the function that gets called upon change of the widget iI call "update()" to repaint the widget. I tried "updateGeometry()" but that didn't change anything...
Thanks for the help so far!
Re: QScrollArea and resizing
Where did you call updateGeometry? Could you provide a minimal compilable example reproducing the problem?
Re: QScrollArea and resizing
Try
setSizePolicy(QSizePolicy::Ignored, QSizePolicy::Ignored);
like examples/widgets/imageviewer.
or MinimumExpanding ? see the doc for QSizePolicy --
QSizePolicy::MinimumExpanding should get as much space as possible
QSizePolicy::Ignored will get as much space as possible
It's not clear to me if Ignored really means ignore the sizeHints too.
Can any expert describe how sizeHints work ?
walk the widget tree, getting min / preferred / max sizes
layout engine ..
Fwiw google "Qt scrollarea bug" has several hits, versionitis ?
cheers