Skip to content
Permalink
Browse files

combobox for cardinality

  • Loading branch information
signedav committed Oct 27, 2017
1 parent 6055e71 commit 665a6f0376371daf2562430b80de017d7d497d8e
@@ -12,12 +12,20 @@ QgsAttributeRelationEdit::~QgsAttributeRelationEdit()
{
}

void QgsAttributeRelationEdit::setCardinalityCombo( const QString &cardinalityComboItem )
{
coCardinality->addItem( cardinalityComboItem );
}

void QgsAttributeRelationEdit::setCardinality( const QString &cardinality )
{
leCardinality->setText( cardinality );
int idx = coCardinality->findText( cardinality );

if ( idx != -1 )
coCardinality->setCurrentIndex( idx );
}

QString QgsAttributeRelationEdit::cardinality()
{
return leCardinality->text();
return coCardinality->currentText();
}
@@ -28,12 +28,17 @@ class APP_EXPORT QgsAttributeRelationEdit: public QWidget, private Ui::QgsAttrib
~QgsAttributeRelationEdit();

/**
* Setter for lable alias
* Setter for combo cardinality item
*/
void setCardinalityCombo( const QString &cardinalityComboItem );

/**
* Setter for combo cardinality
*/
void setCardinality( const QString &cardinality );

/**
* Getter for lable alias
* Getter for combo cardinality
*/
QString cardinality();

@@ -196,6 +196,8 @@ void QgsAttributesFormProperties::loadAttributeRelationEdit()
RelationConfig cfg = currentItem->data( 0, RelationConfigRole).value<RelationConfig>();

mAttributeRelationEdit = new QgsAttributeRelationEdit( currentItem->data( 0, FieldNameRole ).toString(), mAttributeTypeFrame );
mAttributeRelationEdit->setCardinalityCombo( "testoption 1");
mAttributeRelationEdit->setCardinalityCombo( "testoption 2");
mAttributeRelationEdit->setCardinality( cfg.mCardinality );

mAttributeRelationEdit->layout()->setMargin( 0 );
@@ -28,7 +28,7 @@
</widget>
</item>
<item row="0" column="1">
<widget class="QLineEdit" name="leCardinality"/>
<widget class="QComboBox" name="coCardinality"/>
</item>
</layout>
</widget>

0 comments on commit 665a6f0

Please sign in to comment.
You can’t perform that action at this time.