mapping correction

This commit is contained in:
Christophe Alexandre 2008-05-06 23:20:10 +00:00
parent ab1448a18f
commit 5d092e27c0
1 changed files with 2 additions and 1 deletions

View File

@ -83,12 +83,13 @@ void HInspectorWidget::keyPressEvent(QKeyEvent *event) {
if (event->matches(QKeySequence::MoveToNextChar)) { if (event->matches(QKeySequence::MoveToNextChar)) {
QModelIndex index = slotsView->currentIndex(); QModelIndex index = slotsView->currentIndex();
if (index.isValid()) { if (index.isValid()) {
unsigned row = index.row();
QSortFilterProxyModel* sortModel = QSortFilterProxyModel* sortModel =
static_cast<QSortFilterProxyModel*>(slotsView->model()); static_cast<QSortFilterProxyModel*>(slotsView->model());
QModelIndex modelIndex = sortModel->mapToSource(index);
RecordModel* recordModel = RecordModel* recordModel =
static_cast<RecordModel*>(sortModel->sourceModel()); static_cast<RecordModel*>(sortModel->sourceModel());
Record* record = recordModel->getRecord(); Record* record = recordModel->getRecord();
unsigned row = modelIndex.row();
Slot* slot = record->getSlot(row); Slot* slot = record->getSlot(row);
if (slot) { if (slot) {
Record* newRecord = slot->getDataRecord(); Record* newRecord = slot->getDataRecord();