Details
-
Bug
-
Resolution: Incomplete
-
Not Evaluated
-
None
-
4.7.3
-
None
-
qt 4.7.3 windows/mingw
Description
When a widget mapped via QDataWidgetMapper to a QSqlTableModel model loses the focus and a not mapped widget gets the focus
if the mapper uses the AutoSubmit policy then the mapper loses the current model index.
This happens only when the model is a QSqlTableModel. If the model is a QStandardItemModel everything work fine.
I've attached a small project to demonstrate this bug. the test button runs this code:
void MainWindow::on_run_test_clicked() { mapper->setCurrentIndex(0); this->ui->tableView->setFocus(Qt::MouseFocusReason); this->ui->tableView->selectionModel()->select(this->ui->tableView->model()->index(0,0), QItemSelectionModel::ClearAndSelect); this->ui->dateTimeEdit->setFocus(Qt::MouseFocusReason); this->ui->lineEdit->setFocus(Qt::MouseFocusReason); this->ui->test->setText(QString("this->mapper->currentIndex() == %1").arg(this->mapper->currentIndex())); }
comment line mainwindow.cpp:12 to run the test using QStandardItemModel.