23 Ui::QgsRelationManagerDialogBase(),
24 mRelationManager( relationMgr )
47 int row = mRelationsTable->rowCount();
48 mRelationsTable->insertRow( row );
50 QTableWidgetItem* item =
new QTableWidgetItem( rel.
name() );
52 item->setData( Qt::UserRole, QVariant::fromValue<QgsRelation>( rel ) );
53 mRelationsTable->setItem( row, 0, item );
57 item->setFlags( Qt::ItemIsEditable );
58 mRelationsTable->setItem( row, 1, item );
60 item =
new QTableWidgetItem( rel.
fieldPairs().first().referencingField() );
61 item->setFlags( Qt::ItemIsEditable );
62 mRelationsTable->setItem( row, 2, item );
65 item->setFlags( Qt::ItemIsEditable );
66 mRelationsTable->setItem( row, 3, item );
68 item =
new QTableWidgetItem( rel.
fieldPairs().first().referencedField() );
69 item->setFlags( Qt::ItemIsEditable );
70 mRelationsTable->setItem( row, 4, item );
72 item =
new QTableWidgetItem( rel.
id() );
73 item->setFlags( Qt::ItemIsEditable );
74 mRelationsTable->setItem( row, 5, item );
90 relationId = QString(
"%1_%2_%3_%4" )
96 QStringList existingNames;
101 existingNames << rel.
id();
104 QString tempId = relationId +
"_%1";
106 while ( existingNames.contains( relationId ) )
108 relationId = tempId.arg( suffix );
121 if ( mRelationsTable->currentIndex().isValid() )
122 mRelationsTable->removeRow( mRelationsTable->currentItem()->row() );
129 for (
int i = 0; i < mRelationsTable->rowCount(); ++i )
133 relation.
setRelationName( mRelationsTable->item( i, 0 )->data( Qt::DisplayRole ).toString() );
134 relations << relation;