mirror of
https://github.com/sqlitebrowser/sqlitebrowser.git
synced 2026-01-20 11:00:44 -06:00
Show error message when changing table data fails
Give the user an error message when setting new data for a cell fails. This is especially useful when the problem is caused by foreign key constraints.
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
#include "sqlitetablemodel.h"
|
||||
#include "sqlitedb.h"
|
||||
#include <QDebug>
|
||||
#include <QMessageBox>
|
||||
#include <QApplication>
|
||||
|
||||
SqliteTableModel::SqliteTableModel(QObject* parent, DBBrowserDB* db, size_t chunkSize)
|
||||
: QAbstractTableModel(parent)
|
||||
@@ -160,6 +162,7 @@ bool SqliteTableModel::setData(const QModelIndex& index, const QVariant& value,
|
||||
emit(dataChanged(index, index));
|
||||
return true;
|
||||
} else {
|
||||
QMessageBox::warning(0, qApp->applicationName(), tr("Error changing data:\n%1").arg(m_db->lastErrorMessage));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user