Hai all,
If i don't want to scroll the contents of scrollarea by scrolling mousewheel and i want to scroll the contents of scrollarea only by dragging the slider of scrollarea , how can i do that?
Thanks.
Hai all,
If i don't want to scroll the contents of scrollarea by scrolling mousewheel and i want to scroll the contents of scrollarea only by dragging the slider of scrollarea , how can i do that?
Thanks.
Subclass the scrollarea and reimp QAbstractScrollArea::wheelEvent() that it does nothing, or install an event filter, that eats the mouse wheel event.
Hai,
Thanks Lykurg for your reply.I have installed eventfilter for mousewheel. But still the contents are scrolled when I scroll the mousewheel.Why so?Am I doing anything wrong?
bool MainWindow::eventFilter(QObject *obj, QEvent *event)
{
if (obj == ui->scrollArea)
{
if (event->type() == QEvent::Wheel)
{
return true;
}
else
{
return false;
}
}
else
{
return QMainWindow::eventFilter(obj, event);
}
}
Thanks.
Hi, I can't try it right now, but also try to use the viewport of the scroll view: QAbstractScrollArea::viewport(). Also see if the event filter is actually called.
Hi,
Yes, i have called eventfilter in constuctor of class .
ui->scrollArea->installEventFilter(this);
Now I will try viewport as you said.
Thanks
What I want to do is , I have an Image in scrollarea . I dont want to scroll the contents using mousewheel.Instead I want to zoom the image to the mouse point by mousewheel.So i thought to adjust the scrollbar position according to the mouse point.For that I need to disable the scrolling option.But I want scrollbars too. How can I do this?
Bookmarks