Connect QPushbutton and QListWidget-Scrollbar
hi,
I'm looking for a Way to connect the Scrollbar of a QListWidget with a QPushbutton. So that I can use two QPushbuttons to scroll up and down. I only find the scrollToTop() and scrollToBottom() functions, but they scroll all the way and I only want them to scroll a Step, like the small Buttons on the Scrollbar.
Thanks in advance!
Re: Connect QPushbutton and QListWidget-Scrollbar
You need to calculate which item should be visible and use QAbstractItemView::scrollTo()
Re: Connect QPushbutton and QListWidget-Scrollbar
Thanks for your Answer. Yeah i found this too, but I´m not really happy with it. I was hoping that there is a way to use the triggerActions provided by the slider of the Scrollbar. I mean you can use these Action with your mouse (like "page down" etc.).
Added after 37 minutes:
ok here is the Answer:
void MainView::on_button_up_clicked()
{
ui->listWidget_entries->verticalScrollBar()->triggerAction(QAbstractSlider::SliderPageStepSub);
}