Esempio n. 1
0
void QgsPropertyOverrideButton::init( int propertyKey, const QgsProperty &property, const QgsPropertiesDefinition &definitions, const QgsVectorLayer *layer, bool auxiliaryStorageEnabled )
{
  mVectorLayer = layer;
  mAuxiliaryStorageEnabled = auxiliaryStorageEnabled;
  setToProperty( property );
  mPropertyKey = propertyKey;

  mDefinition = definitions.value( propertyKey );
  mDataTypes = mDefinition.dataType();

  mInputDescription = mDefinition.helpText();
  mFullDescription.clear();
  mUsageInfo.clear();

  // set up data types string
  mDataTypesString.clear();

  QStringList ts;
  switch ( mDataTypes )
  {
    case QgsPropertyDefinition::DataTypeBoolean:
      ts << tr( "boolean" );
      FALLTHROUGH;

    case QgsPropertyDefinition::DataTypeNumeric:
      ts << tr( "int" );
      ts << tr( "double" );
      FALLTHROUGH;

    case QgsPropertyDefinition::DataTypeString:
      ts << tr( "string" );
      break;
  }

  if ( !ts.isEmpty() )
  {
    mDataTypesString = ts.join( QStringLiteral( ", " ) );
    mActionDataTypes->setText( tr( "Field type: " ) + mDataTypesString );
  }

  updateFieldLists();
  updateGui();
}
void QgsPropertyOverrideButton::init( int propertyKey, const QgsProperty &property, const QgsPropertiesDefinition &definitions, const QgsVectorLayer *layer, bool auxiliaryStorageEnabled )
{
  init( propertyKey, property, definitions.value( propertyKey ), layer, auxiliaryStorageEnabled );
}