下面部分代码源自:QT4.4.3中的Spreadsheet电子表的 例子。。
void Spreadsheet::findNext(const QString &str, Qt::CaseSensitivity cs) //向前查找
{
int row = currentRow();
int column = currentColumn() + 1;
while (row < RowCount) {
while (column < ColumnCount) {
if (text(row, column).contains(str, cs)) {
clearSelection();
setCurrentCell(row, column);
activateWindow();
return;
}
++column;
}
column = 0;
++row;
}
QApplication::beep();
}
void Spreadsheet::findPrevious(const QString &str, Qt::CaseSensitivity cs) //向后查找
{
int row = currentRow();
int column = currentColumn() - 1;
while (row >= 0) {
while (column >= 0) {
if (text(row, column).contains(str, cs)) {
clearSelection();
setCurrentCell(row, column);
activateWindow();
return;
}
--column;
}
column = ColumnCount - 1;
--row;
}
QApplication::beep();
}
我用Qtabwidget和QTabelView写了个用页标显示不同列表的界面(用容器QList<QStringList>listofPairs存储数据) ,
我想用上面的部分代码实现查找功能,而上面电子表用的是QtabelWidget,
请问一下红色的 地方如何替换????