{
if (event
->type
() == QEvent::KeyPress) {
//typecast QEvent to QKeyEvent
QKeyEvent *keyEvent
= static_cast<QKeyEvent
*>
(event
);
//following are checking for target widget where event happens
//checks whether target is listwidget
if(target==this)
{
//checks whether pressed key is 1
if (keyEvent->key() == Qt::Key_1 )
{
m_pMyViewButtonBar->showDialog(this);
here i am using an instance of a splitter to show a dialog
}
else
{
//checks whether pressed key is down
if (keyEvent->key() == Qt::Key_Down )
{
//checks m_count is for number of items upto down scroll to be done
if(m_iCount!=-1 && m_iCount<23)
{
/ /each time 10 items are get scrolled down
m_iCount=m_iCount+10; updateAllMyMainWindowViews(m_iCount,m_iCount+15);
//place where time is spent for execution
}
}
//checks whether pressed key is down
else if(keyEvent->key() == Qt::Key_Up)
{
//checks m_count is for total number of items upto up scroll to be done
if(m_iCount>0)
{
//each time 10 items are get scrolled up
m_iCount=m_iCount-10;
updateAllMyMainWindowViews(m_iCount,m_iCount+15);
}
}
//checks whether pressed key is alt
else if(keyEvent->key() == Qt::Key_Alt)
{
//checks itemcount is not eqalto -1
if(m_iCount!=-1)
{
updateAllMyMainWindowViews(m_iCount,m_iCount+15);
}
}
}
}
}
void QMyView::updateAllMyWindowViews(INT32 start,INT32 end)
{
//From event filter i am trying to updte tha list items
//in event i am trying to update the listwidget items..The listwidget is added to a splitter
m_pSplitterView->updateFirstView(start, end);
m_pSplitterView->updateSecondView(start, end);
m_pSplitterView->updatethirdView(start, end);
m_pSplitterView->updateFourthView(m_iScrollInitialValue, m_iScrollMaxValue);
}
bool QMyView::eventFilter(QObject *target, QEvent *event)
{
if (event->type() == QEvent::KeyPress)
{
//typecast QEvent to QKeyEvent
QKeyEvent *keyEvent = static_cast<QKeyEvent*>(event);
//following are checking for target widget where event happens
//checks whether target is listwidget
if(target==this)
{
//checks whether pressed key is 1
if (keyEvent->key() == Qt::Key_1 )
{
m_pMyViewButtonBar->showDialog(this);
here i am using an instance of a splitter to show a dialog
}
else
{
//checks whether pressed key is down
if (keyEvent->key() == Qt::Key_Down )
{
//checks m_count is for number of items upto down scroll to be done
if(m_iCount!=-1 && m_iCount<23)
{
/ /each time 10 items are get scrolled down
m_iCount=m_iCount+10; updateAllMyMainWindowViews(m_iCount,m_iCount+15);
//place where time is spent for execution
}
}
//checks whether pressed key is down
else if(keyEvent->key() == Qt::Key_Up)
{
//checks m_count is for total number of items upto up scroll to be done
if(m_iCount>0)
{
//each time 10 items are get scrolled up
m_iCount=m_iCount-10;
updateAllMyMainWindowViews(m_iCount,m_iCount+15);
}
}
//checks whether pressed key is alt
else if(keyEvent->key() == Qt::Key_Alt)
{
//checks itemcount is not eqalto -1
if(m_iCount!=-1)
{
updateAllMyMainWindowViews(m_iCount,m_iCount+15);
}
}
}
}
}
void QMyView::updateAllMyWindowViews(INT32 start,INT32 end)
{
//From event filter i am trying to updte tha list items
//in event i am trying to update the listwidget items..The listwidget is added to a splitter
m_pSplitterView->updateFirstView(start, end);
m_pSplitterView->updateSecondView(start, end);
m_pSplitterView->updatethirdView(start, end);
m_pSplitterView->updateFourthView(m_iScrollInitialValue, m_iScrollMaxValue);
}
To copy to clipboard, switch view to plain text mode
I hav an application with a splitter that has 4 listwidgets.I am trying to update 14 items on each scroll,using ScrollToitem in the update methods...How can reduce this scroll time
Bookmarks