bool
QgsProject::readBoolEntry( QString const &scope, const QString & key, bool def,
                           bool * ok ) const
{
  QgsProperty * property = findKey_( scope, key, imp_->properties_ );

  QVariant value;

  if ( property )
  {
    value = property->value();
  }

  bool valid = value.canConvert( QVariant::Bool );

  if ( ok )
  {
    *ok = valid;
  }

  if ( valid )
  {
    return value.toBool();
  }

  return def;
} // QgsProject::readBoolEntry
QStringList
QgsProject::readListEntry( QString const & scope,
                           const QString & key,
                           bool * ok ) const
{
  QgsProperty * property = findKey_( scope, key, imp_->properties_ );

  QVariant value;

  if ( property )
  {
    value = property->value();
  }

  bool valid = QVariant::StringList == value.type();

  if ( ok )
  {
    *ok = valid;
  }

  if ( valid )
  {
    return value.toStringList();
  }

  return QStringList();
} // QgsProject::readListEntry
Beispiel #3
0
QVariant QgsPropertyKey::value() const
{
  QgsProperty *foundQgsProperty = mProperties.value( name() );

  if ( !foundQgsProperty )
  {
    QgsDebugMsg( "key has null child" );
    return QVariant();     // just return an QVariant::Invalid
  }

  return foundQgsProperty->value();
} // QVariant QgsPropertyKey::value()
Beispiel #4
0
QVariant QgsPropertyKey::value() const
{
  QgsProperty * foundQgsProperty;

  if ( 0 == ( foundQgsProperty = mProperties.value( name() ) ) )
  {                        // recurse down to next key
    return foundQgsProperty->value();
  }
  else
  {
    QgsDebugMsg( "key has null child" );

    return QVariant();     // just return an QVariant::Invalid
  }
} // QVariant QgsPropertyKey::value()