summaryrefslogtreecommitdiff
path: root/src/diagramdocument.cpp
diff options
context:
space:
mode:
authorLukáš Lalinský <lalinsky@gmail.com>2008-12-12 16:24:55 +0100
committerLukáš Lalinský <lalinsky@gmail.com>2008-12-12 16:24:55 +0100
commit64e4e7d43e64d1a731db4b10c4391524d32d7cbf (patch)
tree2c5456af1777e55ec962d5ea8b196bffd57d710f /src/diagramdocument.cpp
parente6e60c63f6e96a7ca14ae732846113de717e73a9 (diff)
downloaddbmodel-64e4e7d43e64d1a731db4b10c4391524d32d7cbf.tar.xz
Use unique initial name for new tables
Diffstat (limited to 'src/diagramdocument.cpp')
-rw-r--r--src/diagramdocument.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/diagramdocument.cpp b/src/diagramdocument.cpp
index ced24bc..e5caf13 100644
--- a/src/diagramdocument.cpp
+++ b/src/diagramdocument.cpp
@@ -45,6 +45,8 @@ public:
QPen gridPen;
bool printing;
Notation notation;
+
+ QMap<QString, int> counters;
};
DiagramDocument::DiagramDocument(QObject *parent)
@@ -195,6 +197,7 @@ DiagramDocument::mousePressEvent(QGraphicsSceneMouseEvent *event)
if (m_mode == AddTable && event->button() == Qt::LeftButton) {
DatabaseTable *table = new DatabaseTable();
table->createId();
+ table->setInitialName(1 + d->counters[table->typeName()]++);
table->setPos(event->scenePos());
undoStack()->push(new AddItemCommand(this, table));
clearSelection();