From 64e4e7d43e64d1a731db4b10c4391524d32d7cbf Mon Sep 17 00:00:00 2001 From: Lukáš Lalinský Date: Fri, 12 Dec 2008 16:24:55 +0100 Subject: Use unique initial name for new tables --- src/diagramdocument.cpp | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/diagramdocument.cpp') 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 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(); -- cgit v1.2.3-54-g00ecf