Can we Get Previous Cursor Address
-
Hi every one I am new to Qt
I have one QDialog in that i kept one QtableWidget
and also iam having two Push Buttons
One Button is for adding Rows dynamically to Qtablewidget
and another push button is for Calculating sum of Columnshere my problem
my Tab key is at “Sum” Button
when i pressed Shift+Tab key
Tab position is moving to last but one Row
What i want is It should move to last RowSorry my english not so good, I hope You understand my problem
can any one help in this problem
Thanks in advance -
[quote author="petergollapalli" date="1363780662"]
here my problem
my Tab key is at “Sum” Button
when i pressed Shift+Tab key
Tab position is moving to last but one Row
What i want is It should move to last Row
[/quote]In my opinion you can achieve this behavior if you handle the focus event of QTableWidget using "eventFilter":http://qt-project.org/doc/qt-4.8/qobject.html#eventFilter and select the last row. The source code should be something similar to (please note that I have not tested it):
@
bool MainWindow::eventFilter(QObject *obj, QEvent *event)
{
if (obj == pMyTable)
{
if ( QEvent::FocusIn == event->type() )
{
pMyTable->selectRow(pMyTable->rowCount() - 1);
return true;
}
else
{
return false;
}
}
else
{
// pass the event on to the parent class
return QMainWindow::eventFilter(obj, event);
}
}
@ -
Did you try the solution that I proposed yesterday?
-
where should i include this code
-
[quote author="petergollapalli" date="1363946230"]where should i include this code
[/quote]The "eventFilter is a virtual method of class QObject":http://qt-project.org/doc/qt-5.0/qtcore/qobject.html#eventFilter. The example that I gave is for implementation at a class that inherits "QMainWindow":http://qt-project.org/doc/qt-5.0/qtwidgets/qmainwindow.html.