Skip to content

Commit

Permalink
Fixed save/load from DB sync init
Browse files Browse the repository at this point in the history
  • Loading branch information
elpaso committed Nov 5, 2015
1 parent 42239bc commit 322496a
Show file tree
Hide file tree
Showing 6 changed files with 34 additions and 3 deletions.
9 changes: 9 additions & 0 deletions src/app/qgsfieldsproperties.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,15 @@ QTreeWidgetItem *QgsFieldsProperties::loadAttributeEditorTreeItem( QgsAttributeE
return newWidget;
}

void QgsFieldsProperties::setEditFormInit( const QString &editForm, const QString &editFormInit, const QString &editFormInitCode, const bool editFormInitUseCode )
{
leEditForm->setText( editForm );
leEditFormInit->setText( editFormInit );
leEditFormInitCode->setText( editFormInitCode );
leEditFormInitUseCode->setChecked( editFormInitUseCode );
}


void QgsFieldsProperties::loadAttributeEditorTree()
{
// tabs and groups info
Expand Down
9 changes: 9 additions & 0 deletions src/app/qgsfieldsproperties.h
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,15 @@ class APP_EXPORT QgsFieldsProperties : public QWidget, private Ui_QgsFieldsPrope
void loadAttributeEditorTree();
QTreeWidgetItem *loadAttributeEditorTreeItem( QgsAttributeEditorElement* const widgetDef, QTreeWidgetItem* parent );

/**
* @brief setEditFormInit set the private ui fields
* @param editForm
* @param editFormInit
* @param editFormInitCode
* @param editFormInitUseCode
*/
void setEditFormInit( const QString &editForm, const QString &editFormInit, const QString &editFormInitCode, const bool editFormInitUseCode );

signals:
void toggleEditing();

Expand Down
9 changes: 9 additions & 0 deletions src/app/qgsvectorlayerproperties.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -505,6 +505,10 @@ void QgsVectorLayerProperties::syncToLayer( void )

// set initial state for variable editor
updateVariableEditor();

// updates the init python code and ui
updateFieldsPropertiesDialog();

} // syncToLayer()


Expand Down Expand Up @@ -1299,3 +1303,8 @@ void QgsVectorLayerProperties::updateVariableEditor()
mVariableEditor->reloadContext();
mVariableEditor->setEditableScopeIndex( 2 );
}

void QgsVectorLayerProperties::updateFieldsPropertiesDialog()
{
mFieldsPropertiesDialog->setEditFormInit( layer->editForm(), layer->editFormInit(), layer->editFormInitCode(), layer->editFormInitUseCode() );
}
5 changes: 5 additions & 0 deletions src/app/qgsvectorlayerproperties.h
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,11 @@ class APP_EXPORT QgsVectorLayerProperties : public QgsOptionsDialogBase, private
*/
void updateVariableEditor();

/**
* @brief updates the FieldsPropertiesDialog when syncing the layer properties
*/
void updateFieldsPropertiesDialog();

protected:

void saveStyleAs( StyleType styleType );
Expand Down
1 change: 1 addition & 0 deletions src/core/qgsvectorlayer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1635,6 +1635,7 @@ bool QgsVectorLayer::writeXml( QDomNode & layer_node,
return writeSymbology( layer_node, document, errorMsg );
} // bool QgsVectorLayer::writeXml


bool QgsVectorLayer::readSymbology( const QDomNode& node, QString& errorMessage )
{
emit readCustomSymbology( node.toElement(), errorMessage );
Expand Down
4 changes: 1 addition & 3 deletions src/ui/qgsfieldspropertiesbase.ui
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<rect>
<x>0</x>
<y>0</y>
<width>742</width>
<width>965</width>
<height>634</height>
</rect>
</property>
Expand Down Expand Up @@ -250,8 +250,6 @@ MyForms.py must live on PYTHONPATH, .qgis/python, or inside the project folder.<
<bool>true</bool>
</property>
<layout class="QGridLayout" name="mRelationsFrameLayout"/>
<zorder>leEditFormInitCode</zorder>
<zorder>mPythonInitCodeGroupBox</zorder>
</widget>
<widget class="QgsCollapsibleGroupBox" name="mPythonInitCodeGroupBox">
<property name="enabled">
Expand Down

0 comments on commit 322496a

Please sign in to comment.