mirror of
https://github.com/sqlitebrowser/sqlitebrowser.git
synced 2026-01-20 02:50:46 -06:00
SqliteTableModel: Return from setData() if value hasn't changed
Don't do any changes to the database if the value hasn't actually changed. This avoids settings the dirty flag when there is no need to.
This commit is contained in:
@@ -156,6 +156,10 @@ bool SqliteTableModel::setData(const QModelIndex& index, const QVariant& value,
|
||||
{
|
||||
if(index.isValid() && role == Qt::EditRole)
|
||||
{
|
||||
// Don't do anything if the data hasn't changed
|
||||
if(m_data.at(index.row()).at(index.column()) == value)
|
||||
return true;
|
||||
|
||||
if(m_db->updateRecord(m_sTable, m_headers.at(index.column()), m_data[index.row()].at(0).toInt(), value.toByteArray()))
|
||||
{
|
||||
// Only update the cache if this row has already been read, if not there's no need to do any changes to the cache
|
||||
|
||||
Reference in New Issue
Block a user