Results 1 to 8 of 8

Thread: Events on QScrollBar

  1. #1
    Join Date
    May 2010
    Location
    China
    Posts
    66
    Thanks
    8
    Qt products
    Qt4
    Platforms
    Windows

    Smile Events on QScrollBar

    i want to create a widget like microsoft excel,and when i click the up or down button of the scrollbar the rows of the spreadsheet will increase or decrease,i inherit this widget from QTableView, how to slove this problem?


    i can't find any event to hanle this

  2. #2
    Join Date
    May 2010
    Location
    China
    Posts
    66
    Thanks
    8
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Events on QScrollBar

    Anyone can help me ?thanks

  3. #3
    Join Date
    Jun 2010
    Location
    India
    Posts
    50
    Thanks
    1
    Thanked 15 Times in 14 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Events on QScrollBar

    Hi try

    pTableView->verticalScrollBar()->setSingleStep ( int value )

  4. #4
    Join Date
    May 2010
    Location
    China
    Posts
    66
    Thanks
    8
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Events on QScrollBar

    i want to know the mouse click Event,not the function,

  5. #5
    Join Date
    May 2010
    Location
    China
    Posts
    66
    Thanks
    8
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Events on QScrollBar

    i will waiting the answer on line all the time ,anyone can help me?

  6. #6
    Join Date
    May 2010
    Location
    China
    Posts
    66
    Thanks
    8
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Events on QScrollBar

    anyone help me ,thanks you

  7. #7
    Join Date
    Jun 2010
    Location
    India
    Posts
    50
    Thanks
    1
    Thanked 15 Times in 14 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Events on QScrollBar

    Hi,

    To handle the mouse click events on the buttons of the scrollbar the following code may be used.

    Qt Code:
    1. QScrollBar* pScroll=pYourTableView->verticalScrollBar();
    2. if(pScroll){
    3. connect(pScroll,SIGNAL(actionTriggered (int)),this,handleScrollAction(int)));
    4. }
    5. void YourClass::handleScrollAction(int action)
    6. {
    7. if(action==QAbstractSlider::SliderSingleStepSub)
    8. qDebug() << "Top Button Clicked";
    9. else if (action==QAbstactSlider::SliderSingleStepAdd)
    10. qDebug() << "Bottom Button Clicked";
    11.  
    12. }
    To copy to clipboard, switch view to plain text mode 

  8. #8
    Join Date
    May 2010
    Location
    China
    Posts
    66
    Thanks
    8
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Events on QScrollBar

    thank you!

Similar Threads

  1. customizing QScrollbar
    By MarkoSan in forum Qt Programming
    Replies: 7
    Last Post: 15th October 2009, 18:51
  2. QGraphicsView and QScrollBar
    By paolom in forum Qt Programming
    Replies: 3
    Last Post: 2nd October 2009, 08:19
  3. QScrollbar color
    By ntp in forum Qt Programming
    Replies: 0
    Last Post: 28th August 2008, 17:59
  4. qscrollbar styling
    By 20khz in forum Qt Programming
    Replies: 0
    Last Post: 5th May 2008, 14:17
  5. QScrollbar stylesheet
    By GuS in forum Qt Programming
    Replies: 34
    Last Post: 4th December 2007, 16:12

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.