void QgsRelationReferenceFactory::writeConfig( const QgsEditorWidgetConfig& config, QDomElement& configElement, QDomDocument& doc, const QgsVectorLayer* layer, int fieldIdx ) { Q_UNUSED( doc ); Q_UNUSED( layer ); Q_UNUSED( fieldIdx ); configElement.setAttribute( "AllowNULL", config["AllowNULL"].toBool() ); configElement.setAttribute( "OrderByValue", config["OrderByValue"].toBool() ); configElement.setAttribute( "ShowForm", config["ShowForm"].toBool() ); configElement.setAttribute( "Relation", config["Relation"].toString() ); configElement.setAttribute( "MapIdentification", config["MapIdentification"].toBool() ); configElement.setAttribute( "ReadOnly", config["ReadOnly"].toBool() ); if ( config.contains( "FilterFields" ) ) { QDomElement filterFields = doc.createElement( "FilterFields" ); Q_FOREACH ( const QString& field, config["FilterFields"].toStringList() ) { QDomElement fieldElem = doc.createElement( "field" ); fieldElem.setAttribute( "name", field ); filterFields.appendChild( fieldElem ); } configElement.appendChild( filterFields ); filterFields.setAttribute( "ChainFilters", config["ChainFilters"].toBool() ); }
void QgsExternalResourceWidgetFactory::writeConfig( const QgsEditorWidgetConfig& config, QDomElement& configElement, QDomDocument& doc, const QgsVectorLayer* layer, int fieldIdx ) { Q_UNUSED( doc ) Q_UNUSED( layer ) Q_UNUSED( fieldIdx ) configElement.setAttribute( "FileWidget", config.value( "FileWidget", true ).toBool() ); configElement.setAttribute( "FileWidgetButton", config.value( "FileWidgetButton", true ).toBool() ); // Non mandatory options are not saved into project file (to save some space). if ( config.contains( "UseLink" ) ) configElement.setAttribute( "UseLink", config.value( "UseLink" ).toBool() ); if ( config.contains( "FullUrl" ) ) configElement.setAttribute( "FullUrl", config.value( "FullUrl" ).toBool() ); if ( config.contains( "DefaultRoot" ) ) configElement.setAttribute( "DefaultRoot", config.value( "DefaultRoot" ).toString() ); if ( config.contains( "RelativeStorage" ) ) configElement.setAttribute( "RelativeStorage" , config.value( "RelativeStorage" ).toString() ); if ( config.contains( "DocumentViewer" ) ) configElement.setAttribute( "DocumentViewer", config.value( "DocumentViewer" ).toInt() ); if ( config.contains( "FileWidgetFilter" ) ) configElement.setAttribute( "FileWidgetFilter", config.value( "FileWidgetFilter" ).toString() ); configElement.setAttribute( "StorageMode", config.value( "StorageMode" ).toString() ); }
void QgsRelationReferenceConfigDlg::setConfig( const QgsEditorWidgetConfig& config ) { if ( config.contains( "AllowNULL" ) ) { mCbxAllowNull->setChecked( config.value( "AllowNULL" ).toBool() ); } if ( config.contains( "OrderByValue" ) ) { mCbxOrderByValue->setChecked( config.value( "OrderByValue" ).toBool() ); } if ( config.contains( "ShowForm" ) ) { mCbxShowForm->setChecked( config.value( "ShowForm" ).toBool() ); } if ( config.contains( "Relation" ) ) { mComboRelation->setCurrentIndex( mComboRelation->findData( config.value( "Relation" ).toString() ) ); relationChanged( mComboRelation->currentIndex() ); } if ( config.contains( "MapIdentification" ) ) { mCbxMapIdentification->setChecked( config.value( "MapIdentification" ).toBool() ); } if ( config.contains( "AllowAddFeatures" ) ) mCbxAllowAddFeatures->setChecked( config.value( "AllowAddFeatures" ).toBool() ); if ( config.contains( "ReadOnly" ) ) { mCbxReadOnly->setChecked( config.value( "ReadOnly" ).toBool() ); } if ( config.contains( "FilterFields" ) ) { mFilterGroupBox->setChecked( true ); Q_FOREACH ( const QString& fld, config.value( "FilterFields" ).toStringList() ) { addFilterField( fld ); } mCbxChainFilters->setChecked( config.value( "ChainFilters" ).toBool() ); }
void QgsRangeWidgetFactory::writeConfig( const QgsEditorWidgetConfig& config, QDomElement& configElement, QDomDocument& doc, const QgsVectorLayer* layer, int fieldIdx ) { Q_UNUSED( doc ); Q_UNUSED( layer ); Q_UNUSED( fieldIdx ); configElement.setAttribute( "Style", config["Style"].toString() ); configElement.setAttribute( "Min", config["Min"].toInt() ); configElement.setAttribute( "Max", config["Max"].toInt() ); configElement.setAttribute( "Step", config["Step"].toInt() ); configElement.setAttribute( "AllowNull", config["AllowNull"].toBool() ); if ( config.contains( "Suffix" ) ) { configElement.setAttribute( "Suffix", config["Suffix"].toString() ); } }
unsigned int QgsDateTimeEditFactory::fieldScore( const QgsVectorLayer* vl, int fieldIdx ) const { const QgsField field = vl->fields().field( fieldIdx ); const QVariant::Type type = field.type(); const QgsEditorWidgetConfig config = vl->editFormConfig().widgetConfig( field.name() ); if ( type == QVariant::DateTime || type == QVariant::Date || type == QVariant::Time || config.contains( QStringLiteral( "field_format" ) ) ) { return 20; } else { return 5; } }
void QgsExternalResourceConfigDlg::setConfig( const QgsEditorWidgetConfig& config ) { if ( config.contains( "FileWidget" ) ) { mFileWidgetGroupBox->setChecked( config.value( "FileWidget" ).toBool() ); } if ( config.contains( "FileWidget" ) ) { mFileWidgetButtonGroupBox->setChecked( config.value( "FileWidgetButton" ).toBool() ); } if ( config.contains( "FileWidgetFilter" ) ) { mFileWidgetFilterLineEdit->setText( config.value( "Filter" ).toString() ); } if ( config.contains( "UseLink" ) ) { mUseLink->setChecked( config.value( "UseLink" ).toBool() ); if ( config.contains( "FullUrl" ) ) mFullUrl->setChecked( true ); } if ( config.contains( "DefaultRoot" ) ) { mRootPath->setText( config.value( "DefaultRoot" ).toString() ); } // relative storage if ( config.contains( "RelativeStorage" ) ) { int relative = config.value( "RelativeStorage" ).toInt(); if (( QgsFileWidget::RelativeStorage )relative == QgsFileWidget::Absolute ) { mRelativeGroupBox->setChecked( false ); } else { mRelativeGroupBox->setChecked( true ); mRelativeButtonGroup->button( relative )->setChecked( true ); } } // set storage mode if ( config.contains( "StorageMode" ) ) { int mode = config.value( "StorageMode" ).toInt(); mStorageButtonGroup->button( mode )->setChecked( true ); } // Document viewer if ( config.contains( "DocumentViewer" ) ) { QgsExternalResourceWidget::DocumentViewerContent content = ( QgsExternalResourceWidget::DocumentViewerContent )config.value( "DocumentViewer" ).toInt(); mDocumentViewerGroupBox->setChecked( content != QgsExternalResourceWidget::NoContent ); mDocumentViewerContentComboBox->setCurrentIndex( mDocumentViewerContentComboBox->findData( content ) ); if ( config.contains( "DocumentViewerHeight" ) ) { mDocumentViewerHeight->setValue( config.value( "DocumentViewerHeight" ).toInt() ); } if ( config.contains( "DocumentViewerWidth" ) ) { mDocumentViewerWidth->setValue( config.value( "DocumentViewerWidth" ).toInt() ); } } }