diff options
author | Lukáš Lalinský <lalinsky@gmail.com> | 2008-12-06 13:05:46 +0100 |
---|---|---|
committer | Lukáš Lalinský <lalinsky@gmail.com> | 2008-12-06 13:05:46 +0100 |
commit | d066a498ca602b9c4f38bc141b8ece0310fc7268 (patch) | |
tree | 78b2f6674b0b79b62da58f8eb470c4646296edc5 /databasemodel.cpp | |
parent | 84b8e18f5c5b1c9cfe5291c57ee15fd01ccb40a6 (diff) | |
download | dbmodel-d066a498ca602b9c4f38bc141b8ece0310fc7268.tar.xz |
Add some item base classes, rename stuff
Diffstat (limited to 'databasemodel.cpp')
-rw-r--r-- | databasemodel.cpp | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/databasemodel.cpp b/databasemodel.cpp index 60a54e0..4068ca5 100644 --- a/databasemodel.cpp +++ b/databasemodel.cpp @@ -16,7 +16,7 @@ #include "databasemodel.h" #include "databasetable.h" -#include "databaserelation.h" +#include "databaserelationship.h" #include "column.h" #include <QGraphicsItem> #include <QDebug> @@ -46,7 +46,7 @@ DatabaseModel::setMode(Mode mode) void DatabaseModel::updatePositions(DatabaseTable *table) { - foreach (DatabaseRelation *relation, findTableRelations(table)) { + foreach (DatabaseRelationship *relation, findTableRelations(table)) { relation->updatePositions(); } } @@ -97,7 +97,7 @@ DatabaseModel::mouseReleaseEvent(QGraphicsSceneMouseEvent *event) DatabaseTable *target = qgraphicsitem_cast<DatabaseTable *>(itemAt(m_line->line().p2())); if (source && target && source != target) { //qDebug() << "Add relation between " << source << " and " << target; - DatabaseRelation *relation = new DatabaseRelation(); + DatabaseRelationship *relation = new DatabaseRelationship(); relation->setSource(source); relation->setTarget(target); relation->setZValue(1.0); @@ -129,7 +129,7 @@ DatabaseModel::deleteSelectedItems() foreach (QGraphicsItem *item, selectedItems()) { DatabaseTable *table = qgraphicsitem_cast<DatabaseTable *>(item); if (table) { - foreach (DatabaseRelation *relation, findTableRelations(table)) { + foreach (DatabaseRelationship *relation, findTableRelations(table)) { removeItem(relation); m_relations.removeAll(relation); } @@ -139,11 +139,11 @@ DatabaseModel::deleteSelectedItems() } } -QList<DatabaseRelation *> +QList<DatabaseRelationship *> DatabaseModel::findTableRelations(DatabaseTable *table) { - QList<DatabaseRelation *> result; - foreach (DatabaseRelation *relation, m_relations) { + QList<DatabaseRelationship *> result; + foreach (DatabaseRelationship *relation, m_relations) { if (relation->source() == table || relation->target() == table) { result << relation; } @@ -212,7 +212,7 @@ DatabaseModel::save(const QString &fileName) QDomElement relationListElement = doc.createElement("relation-list"); root.appendChild(relationListElement); - foreach (DatabaseRelation *relation, m_relations) { + foreach (DatabaseRelationship *relation, m_relations) { QDomElement relationElement = doc.createElement("relation"); relationElement.setAttribute("from", QString::number(m_tables.indexOf(relation->source()))); relationElement.setAttribute("to", QString::number(m_tables.indexOf(relation->target()))); @@ -286,7 +286,7 @@ DatabaseModel::load(const QString &fileName) if (ok) { int index1 = relationElement.attribute("to").toInt(&ok); if (ok) { - DatabaseRelation *relation = new DatabaseRelation(); + DatabaseRelationship *relation = new DatabaseRelationship(); relation->setSource(m_tables[index0]); relation->setTarget(m_tables[index1]); m_relations << relation; |