PDA

View Full Version : Problem with KeyPress event and QTableView



ranna
7th January 2009, 09:55
Hi,

I have an issue with moving next cell in a QTableView by pressing Key_Return. In some cases like a cell has dropdown list box as its item and from that cell if i press Enter/Return key it throws a exception while exetuing this->setCurrentIndex(Index).

this refers to a object of QTableView
and Index refers to a QModelIndex.

The exception is
ASSERT: "VisualRow != -1" in file itemviews\qtableview.cpp line 932. (I am using Qt 4.4).

sample code segment


{
const QModelIndex& Index = this->moveCursor(QAbstractItemView::MoveNext, Qt::KeypadModifier);
if(Index.isValid())
this->setCurrentIndex(Index);
}

the problem only occurs if the current cell itself has a ComboBox or other QWidgets

Please share your ideas to solve ths issue.

jpn
16th January 2009, 20:01
...
it throws a exception while exetuing this->setCurrentIndex(Index).
...

The assert you're referring to is actually in QTableView::moveCursor(). Anyway, could you provide a minimal compilable example that reproduces the problem?