Results 1 to 3 of 3

Thread: Connect QPushbutton and QListWidget-Scrollbar

  1. #1
    Join Date
    Nov 2015
    Posts
    2
    Qt products
    Qt5
    Platforms
    Unix/X11 Windows Android

    Question 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!

  2. #2
    Join Date
    Feb 2012
    Location
    Warsaw, Poland
    Posts
    37
    Thanks
    3
    Thanked 6 Times in 6 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows Android

    Default Re: Connect QPushbutton and QListWidget-Scrollbar

    You need to calculate which item should be visible and use QAbstractItemView::scrollTo()

  3. #3
    Join Date
    Nov 2015
    Posts
    2
    Qt products
    Qt5
    Platforms
    Unix/X11 Windows Android

    Default 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);
    }
    Last edited by BaronVonBullshit; 5th November 2015 at 14:41.

Similar Threads

  1. QListWidget in QtableView with scrollbar
    By jwill222 in forum Qt Programming
    Replies: 3
    Last Post: 12th May 2015, 03:25
  2. QListWidget scrollbar position
    By papillon in forum Qt Programming
    Replies: 1
    Last Post: 9th September 2011, 00:44
  3. connect a qpushbutton a slot
    By Lycus HackerEmo in forum Newbie
    Replies: 13
    Last Post: 29th March 2010, 10:14
  4. QListWidget Scrollbar
    By WeeMan in forum Qt Programming
    Replies: 6
    Last Post: 19th March 2010, 00:15
  5. QListWidget + setWindowFlags = bad scrollbar
    By trallallero in forum Qt Programming
    Replies: 5
    Last Post: 9th December 2009, 12:06

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.