Important: Please read the Qt Code of Conduct -

QScroller with QStackedWIdgets does not work on stacked widgets

  • Hello,
    I have an application that has two stacked widgets with each page showing Image using QLabel and QScrollArea for scrolling during zoom. I added QScroller property to enable dragging during zoom in on both pages using this code:

        QVariant OvershootPolicy = QVariant::fromValue<QScrollerProperties::OvershootPolicy>(QScrollerProperties::OvershootAlwaysOff);
        QScrollerProperties ScrollerProperties = QScroller::scroller(scrollArea->viewport())->scrollerProperties();
        ScrollerProperties.setScrollMetric(QScrollerProperties::VerticalOvershootPolicy, OvershootPolicy);
        ScrollerProperties.setScrollMetric(QScrollerProperties::HorizontalOvershootPolicy, OvershootPolicy);
        ScrollerProperties.setScrollMetric(QScrollerProperties::MaximumVelocity, 0);
        ScrollerProperties.setScrollMetric(QScrollerProperties::MinimumVelocity, 0);
       // QScroller::scroller(scrollArea_3->viewport())->setScrollerProperties(ScrollerProperties); 

    Presently I have commented out the scrollArea_3 as it does not work correctly work if I enable QScroller on both pages. If I enable both, then the scrollArea works fine but scrollArea_3 i.e. on other page does not register to mouse click over entire area of scrollArea_3 but only specific points like right most and down most margin.
    While searching on internet, I found this bug
    QTBUG-70681 which looks similar to my problem. I would just like to know if this is resolved or still persisting as this issue was opened on 2018 and status is still open and if there is any workaround to this issue. Thanks

Log in to reply