diff options
author | Lukáš Lalinský <lalinsky@gmail.com> | 2008-12-12 16:43:11 +0100 |
---|---|---|
committer | Lukáš Lalinský <lalinsky@gmail.com> | 2008-12-12 16:43:11 +0100 |
commit | 3a309a16e62a622f1b2ef90871086b274353e9d6 (patch) | |
tree | 321e99b888503d761255d03eefad369b4327be32 | |
parent | 64e4e7d43e64d1a731db4b10c4391524d32d7cbf (diff) | |
download | dbmodel-3a309a16e62a622f1b2ef90871086b274353e9d6.tar.gz dbmodel-3a309a16e62a622f1b2ef90871086b274353e9d6.tar.bz2 |
Make setPrimaryKey+setRequired a single action
-rw-r--r-- | src/items/database/columnlistmodel.cpp | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/src/items/database/columnlistmodel.cpp b/src/items/database/columnlistmodel.cpp index 940115f..c826611 100644 --- a/src/items/database/columnlistmodel.cpp +++ b/src/items/database/columnlistmodel.cpp @@ -135,13 +135,16 @@ ColumnListModel::setData(const QModelIndex &index, const QVariant &value, int ro goto OK; } if (index.column() == 3) { - m_columnList->table()->document()->undoStack()->push( - new SetObjectPropertyCommand(column, "primaryKey", checked)); + QUndoCommand *command; if (!column->isRequired()) { - // TODO is there a simple way to group this with the previous command? - m_columnList->table()->document()->undoStack()->push( - new SetObjectPropertyCommand(column, "required", true)); + command = new QUndoCommand(); + (void *)new SetObjectPropertyCommand(column, "primaryKey", checked, command); + (void *)new SetObjectPropertyCommand(column, "required", true, command); + } + else { + command = new SetObjectPropertyCommand(column, "primaryKey", checked); } + m_columnList->table()->document()->undoStack()->push(command); goto OK; } } |