PDA

View Full Version : Events on QScrollBar



xiongxiongchuan
14th June 2010, 21: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, 05:39
Anyone can help me ?thanks

agathiyaa
15th June 2010, 05:52
Hi try

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

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

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

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

agathiyaa
15th June 2010, 16: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, 11:32
thank you!