Skip to content
Permalink
Browse files

relations in list

alias comment in gui (not ready yet)
  • Loading branch information
signedav committed Oct 26, 2017
1 parent 18b6caf commit 3a547dc5b932c1cc2d0df8f984df4e2f6594ebd4
Showing with 74 additions and 64 deletions.
  1. +26 −7 src/app/qgsattributesformproperties.cpp
  2. +19 −57 src/ui/qgsattributesformproperties.ui
  3. +29 −0 src/ui/qgsattributetypeedit.ui
@@ -57,7 +57,7 @@ void QgsAttributesFormProperties::loadAttributeTypeDialog()
{
QTreeWidgetItem *currentItem = mAvailableWidgetsTree->currentItem();

if ( !currentItem )
if ( !currentItem || !( currentItem->data( 0, DnDTreeRole ).value<DnDTreeItemData>().type()==DnDTreeItemData::Field ) )
mAttributeTypeDialog->setEnabled( false );
else
{
@@ -270,6 +270,7 @@ void QgsAttributesFormProperties::initAvailableWidgetsTree()
mAvailableWidgetsTree->setDragDropMode( QAbstractItemView::DragOnly );

//load Fields

DnDTreeItemData catItemData = DnDTreeItemData( DnDTreeItemData::Container, "Fields");
QTreeWidgetItem *catitem = mAvailableWidgetsTree->addItem( mAvailableWidgetsTree->invisibleRootItem(), catItemData );

@@ -283,6 +284,8 @@ void QgsAttributesFormProperties::initAvailableWidgetsTree()
FieldConfig cfg( mLayer, i );

QTreeWidgetItem *item = mAvailableWidgetsTree->addItem( catitem, itemData );
//QTreeWidgetItem *item = mAvailableWidgetsTree->addItem( mAvailableWidgetsTree->invisibleRootItem(), itemData );

item->setData( 0, FieldConfigRole, cfg );
item->setData( 0, FieldNameRole, field.name() );
}
@@ -293,6 +296,7 @@ void QgsAttributesFormProperties::initAvailableWidgetsTree()
itemData.setText(i, fields.at( i ).name() );
*/


//load Relations
catItemData = DnDTreeItemData( DnDTreeItemData::Container, "Relations");
catitem = mAvailableWidgetsTree->addItem( mAvailableWidgetsTree->invisibleRootItem(), catItemData );
@@ -308,6 +312,7 @@ void QgsAttributesFormProperties::initAvailableWidgetsTree()
item->setData( 0, FieldNameRole, relation.name() );
}


}


@@ -362,7 +367,6 @@ QgsAttributeEditorElement *QgsAttributesFormProperties::createAttributeEditorWid
break;
}

/*dave to do
case DnDTreeItemData::Relation:
{
QgsRelation relation = QgsProject::instance()->relationManager()->relation( itemData.name() );
@@ -372,7 +376,6 @@ QgsAttributeEditorElement *QgsAttributesFormProperties::createAttributeEditorWid
widgetDef = relDef;
break;
}
*/

case DnDTreeItemData::Container:
{
@@ -401,9 +404,13 @@ void QgsAttributesFormProperties::apply()
{
QgsEditFormConfig editFormConfig = mLayer->editFormConfig();

for ( QTreeWidgetItemIterator it( mAvailableWidgetsTree ); *it; ++it )
QTreeWidgetItem* fieldContainer=mAvailableWidgetsTree->invisibleRootItem()->child(0);

for ( int i = 0; i < fieldContainer->childCount(); i++ )
{
int idx = mAvailableWidgetsTree->invisibleRootItem()->indexOfChild( ( *it ) );
QTreeWidgetItem *fieldItem = fieldContainer->child( i );
int idx=fieldContainer->indexOfChild( fieldItem );

QString name = mLayer->fields().at( idx ).name();
FieldConfig cfg = configForChild( idx );

@@ -436,6 +443,8 @@ void QgsAttributesFormProperties::apply()
{
mLayer->removeFieldConstraint( idx, QgsFieldConstraints::ConstraintExpression );
}

//mLayer->setFieldAlias( idx, aliasItem->text() );
}

// tabs and groups
@@ -457,8 +466,19 @@ void QgsAttributesFormProperties::apply()
editFormConfig.setInitFilePath( mInitFilePathLineEdit->text() );
editFormConfig.setInitCodeSource( ( QgsEditFormConfig::PythonInitCodeSource )mInitCodeSourceComboBox->currentIndex() );
editFormConfig.setSuppress( ( QgsEditFormConfig::FeatureFormSuppress )mFormSuppressCmbBx->currentIndex() );
*/

/*
// relations
QTreeWidgetItem* relationContainer=mAvailableWidgetsTree->invisibleRootItem()->child(1);
for ( int i = 0; i < relationContainer->childCount(); i++ )
{
QTreeWidgetItem *relationItem = relationContainer->child( i );
int idx=relationContainer->indexOfChild( relationItem );
QString name = mLayer->fields().at( idx ).name();
for ( int i = 0; i < mRelationsList->rowCount(); ++i )
{
QVariantMap cfg;
@@ -477,8 +497,7 @@ void QgsAttributesFormProperties::apply()
editFormConfig.setWidgetConfig( relationName, cfg );
}
*/

*/
mLayer->setEditFormConfig( editFormConfig );
}

@@ -33,32 +33,36 @@
</property>
<widget class="QWidget" name="widget" native="true">
<layout class="QGridLayout" name="gridLayout_3">
<item row="2" column="1">
<widget class="QToolButton" name="mRemoveTabOrGroupButton">
<item row="0" column="2">
<widget class="QToolButton" name="mAddTabOrGroupButton">
<property name="text">
<string>...</string>
</property>
<property name="icon">
<iconset resource="../../images/images.qrc">
<normaloff>:/images/themes/default/symbologyRemove.svg</normaloff>:/images/themes/default/symbologyRemove.svg</iconset>
<normaloff>:/images/themes/default/symbologyAdd.svg</normaloff>:/images/themes/default/symbologyAdd.svg</iconset>
</property>
</widget>
</item>
<item row="3" column="1">
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
<item row="0" column="1" rowspan="6">
<widget class="QWidget" name="mFormLayoutWidget" native="true"/>
</item>
<item row="0" column="0" rowspan="6">
<widget class="QWidget" name="mAvailableWidgetsWidget" native="true"/>
</item>
<item row="2" column="2">
<widget class="QToolButton" name="mRemoveTabOrGroupButton">
<property name="text">
<string>...</string>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
<property name="icon">
<iconset resource="../../images/images.qrc">
<normaloff>:/images/themes/default/symbologyRemove.svg</normaloff>:/images/themes/default/symbologyRemove.svg</iconset>
</property>
</spacer>
</widget>
</item>
<item row="0" column="1">
<spacer name="verticalSpacer_2">
<item row="3" column="2">
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
@@ -70,23 +74,6 @@
</property>
</spacer>
</item>
<item row="1" column="1">
<widget class="QToolButton" name="mAddTabOrGroupButton">
<property name="text">
<string>...</string>
</property>
<property name="icon">
<iconset resource="../../images/images.qrc">
<normaloff>:/images/themes/default/symbologyAdd.svg</normaloff>:/images/themes/default/symbologyAdd.svg</iconset>
</property>
</widget>
</item>
<item row="0" column="2" rowspan="4">
<widget class="QWidget" name="mFormLayoutWidget" native="true"/>
</item>
<item row="0" column="0" rowspan="4">
<widget class="QWidget" name="mAvailableWidgetsWidget" native="true"/>
</item>
</layout>
</widget>
<widget class="QWidget" name="mAttributeTypeFrame" native="true">
@@ -98,31 +85,6 @@
</widget>
<resources>
<include location="../../images/images.qrc"/>
<include location="../../images/images.qrc"/>
<include location="../../images/images.qrc"/>
<include location="../../images/images.qrc"/>
<include location="../../images/images.qrc"/>
<include location="../../images/images.qrc"/>
<include location="../../images/images.qrc"/>
<include location="../../images/images.qrc"/>
<include location="../../images/images.qrc"/>
<include location="../../images/images.qrc"/>
<include location="../../images/images.qrc"/>
<include location="../../images/images.qrc"/>
<include location="../../images/images.qrc"/>
<include location="../../images/images.qrc"/>
<include location="../../images/images.qrc"/>
<include location="../../images/images.qrc"/>
<include location="../../images/images.qrc"/>
<include location="../../images/images.qrc"/>
<include location="../../images/images.qrc"/>
<include location="../../images/images.qrc"/>
<include location="../../images/images.qrc"/>
<include location="../../images/images.qrc"/>
<include location="../../images/images.qrc"/>
<include location="../../images/images.qrc"/>
<include location="../../images/images.qrc"/>
<include location="../../images/images.qrc"/>
</resources>
<connections/>
</ui>
@@ -14,6 +14,35 @@
<string>Edit Widget Properties</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QGroupBox" name="groupBox_4">
<property name="title">
<string>General</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<widget class="QLabel" name="label_5">
<property name="text">
<string>Alias</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_6">
<property name="text">
<string>Comment</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLineEdit" name="leAlias"/>
</item>
<item row="1" column="1">
<widget class="QLineEdit" name="leComment"/>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QGroupBox" name="groupBox_3">
<property name="title">

0 comments on commit 3a547dc

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