what is way to create signal and slot on setVerticalScrollBar ?
-
i want to implement on signal and slot such as set vertical scroll bar value get change then call custom created slot function. but how to use it i don't know if any body know about it give me example for below case
ui->scrollArea->setVerticalScrollBar(new QScrollBar(ui->scrollArea)); -
@Qt-embedded-developer Why do you need a signal for that? Its you sets the scroll bar, right? So, you know when it is set.
-
@Qt-embedded-developer For scrolling signal there is https://doc.qt.io/qt-5/qabstractslider.html#valueChanged and https://doc.qt.io/qt-5/qabstractslider.html#sliderMoved
-
@Qt-embedded-developer said in what is way to create signal and slot on setVerticalScrollBar ?:
ui->scrollArea->setVerticalScrollBar(new QScrollBar(ui->scrollArea));
There is no reason to install your own scroll bar object. Based on the settings of the scroll area it will create/show one when needed. You can get a handle to it with
ui->scrollArea->verticalScrollBar()
. Then use the signals of the scollbar to get informed about changes.