Esempio n. 1
0
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
Esempio n. 2
0
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
Esempio n. 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()
Esempio n. 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()