How to get QScrollerProperties from Qscrollbar class?
-
There is a user class that inherits QScrollbar class.
I wanted to put the same scroll attribute everywhere I use this class.
So I tried to give the scroll property when initializing the class, but it failed.I've tried using QScrollerProperties. That was the scroller class. I don't think the scrollbar class or the scroller class is different.
Please tell me how to use the QScrollerProperties property in the scrollbar class.
void usrScrollBar::InitScrollProp() { QScroller* scroller = QScroller::scroller(this); QScrollerProperties properties = QScroller::scroller(scroller)->scrollerProperties(); QVariant overshootPolicy = QVariant::fromValue<QScrollerProperties::OvershootPolicy>(QScrollerProperties::OvershootAlwaysOff); { properties.setScrollMetric(QScrollerProperties::VerticalOvershootPolicy, overshootPolicy); scroller->setScrollerProperties(properties); properties.setScrollMetric(QScrollerProperties::HorizontalOvershootPolicy, overshootPolicy); scroller->setScrollerProperties(properties); } }
-
There is a user class that inherits QScrollbar class.
I wanted to put the same scroll attribute everywhere I use this class.
So I tried to give the scroll property when initializing the class, but it failed.I've tried using QScrollerProperties. That was the scroller class. I don't think the scrollbar class or the scroller class is different.
Please tell me how to use the QScrollerProperties property in the scrollbar class.
void usrScrollBar::InitScrollProp() { QScroller* scroller = QScroller::scroller(this); QScrollerProperties properties = QScroller::scroller(scroller)->scrollerProperties(); QVariant overshootPolicy = QVariant::fromValue<QScrollerProperties::OvershootPolicy>(QScrollerProperties::OvershootAlwaysOff); { properties.setScrollMetric(QScrollerProperties::VerticalOvershootPolicy, overshootPolicy); scroller->setScrollerProperties(properties); properties.setScrollMetric(QScrollerProperties::HorizontalOvershootPolicy, overshootPolicy); scroller->setScrollerProperties(properties); } }
@IknowQT said in How to get QScrollerProperties from Qscrollbar class?:
but it failed.
This is no error description...
-
@IknowQT said in How to get QScrollerProperties from Qscrollbar class?:
but it failed.
This is no error description...
The build was successful. Overshooting is still working.
-
There is a user class that inherits QScrollbar class.
I wanted to put the same scroll attribute everywhere I use this class.
So I tried to give the scroll property when initializing the class, but it failed.I've tried using QScrollerProperties. That was the scroller class. I don't think the scrollbar class or the scroller class is different.
Please tell me how to use the QScrollerProperties property in the scrollbar class.
void usrScrollBar::InitScrollProp() { QScroller* scroller = QScroller::scroller(this); QScrollerProperties properties = QScroller::scroller(scroller)->scrollerProperties(); QVariant overshootPolicy = QVariant::fromValue<QScrollerProperties::OvershootPolicy>(QScrollerProperties::OvershootAlwaysOff); { properties.setScrollMetric(QScrollerProperties::VerticalOvershootPolicy, overshootPolicy); scroller->setScrollerProperties(properties); properties.setScrollMetric(QScrollerProperties::HorizontalOvershootPolicy, overshootPolicy); scroller->setScrollerProperties(properties); } }
You gather the scroller associated with the QScrollbar
QScroller* scroller = QScroller::scroller(this);
then
QScrollerProperties properties = QScroller::scroller(scroller)->scrollerProperties();
you gather/create a QScroller associated with the first QScroller.
Did you mean this perhaps?
QScroller* scroller = QScroller::scroller(this); QScrollerProperties properties = scroller->scrollerProperties();