PDA

View Full Version : Events on QScrollBar



xiongxiongchuan
14th June 2010, 20:15
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 :confused::confused::confused:

xiongxiongchuan
15th June 2010, 04:39
Anyone can help me ?thanks

agathiyaa
15th June 2010, 04:52
Hi try

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

xiongxiongchuan
15th June 2010, 05:00
i want to know the mouse click Event,not the function,

xiongxiongchuan
15th June 2010, 05:58
i will waiting the answer on line all the time ,anyone can help me?

xiongxiongchuan
15th June 2010, 11:04
anyone help me ,thanks you

agathiyaa
15th June 2010, 15:27
Hi,

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



QScrollBar* pScroll=pYourTableView->verticalScrollBar();
if(pScroll){
connect(pScroll,SIGNAL(actionTriggered (int)),this,handleScrollAction(int)));
}
void YourClass::handleScrollAction(int action)
{
if(action==QAbstractSlider::SliderSingleStepSub)
qDebug() << "Top Button Clicked";
else if (action==QAbstactSlider::SliderSingleStepAdd)
qDebug() << "Bottom Button Clicked";

}

xiongxiongchuan
16th June 2010, 10:32
thank you!