qscrollarea slider problem
hi
i have a qlabel whose parent is qscrollarea. i have subclassed the qlabel to receive mouse move events.
whwnever the label(contains image) is moved using mouse (click and then move)
the label inside qscrollarea moves. but the scrollbars are not moving with respect to qlabel.
how to update the scrollbars with respect to qlabel movement.
Re: qscrollarea slider problem
Could we see some code? The event handler at least...
Re: qscrollarea slider problem
You'll need a container widget which is the parent of the movable label. This container widget must automatically grow when label is moved outside its boundaries. This container widget is then set inside the scroll area with QScrollArea::setWidget(). However, there are certain problems with this approach I don't have time to explain right now. Save yourself some time and use QMdiArea with frameless sub windows. ;)
Re: qscrollarea slider problem
Quote:
Could we see some code?
sure:)
Code:
{
mouse_event_distance = mapToParent(event->pos()) - this->pos();
}
{
this->move(mapToParent(event->pos()) - mouse_event_distance);
}
Re: qscrollarea slider problem
Does the scroll area contain anything else or just the label? Because if it contains just the label, use QMdiArea as suggested. If it contains some other elements, use QGraphicsView.