QStringList QgsGeoNodeConnectionUtils::connectionList() { QgsSettings settings; // Add Section manually settings.beginGroup( QStringLiteral( "qgis/connections-geonode" ) ); return settings.childGroups(); }
QMap<QString, QVariant> QgisAppStyleSheet::defaultOptions() { QMap<QString, QVariant> opts; // the following default values, before insertion in opts, can be // configured using the platforms and window servers defined in the // constructor to set reasonable non-Qt defaults for the app stylesheet QgsSettings settings; // handle move from old QgsSettings group (/) to new (/qgis/stylesheet) // NOTE: don't delete old QgsSettings keys, in case user is also running older QGIS QVariant oldFontPointSize = settings.value( QStringLiteral( "fontPointSize" ) ); QVariant oldFontFamily = settings.value( QStringLiteral( "fontFamily" ) ); settings.beginGroup( QStringLiteral( "qgis/stylesheet" ) ); int fontSize = mDefaultFont.pointSize(); if ( mAndroidOS ) { // TODO: find a better default fontsize maybe using DPI detection or so (from Marco Bernasocchi commit) fontSize = 8; } if ( oldFontPointSize.isValid() && !settings.value( QStringLiteral( "fontPointSize" ) ).isValid() ) { fontSize = oldFontPointSize.toInt(); } QgsDebugMsg( QStringLiteral( "fontPointSize: %1" ).arg( fontSize ) ); opts.insert( QStringLiteral( "fontPointSize" ), settings.value( QStringLiteral( "fontPointSize" ), QVariant( fontSize ) ) ); QString fontFamily = mDefaultFont.family(); if ( oldFontFamily.isValid() && !settings.value( QStringLiteral( "fontFamily" ) ).isValid() ) { fontFamily = oldFontFamily.toString(); } fontFamily = settings.value( QStringLiteral( "fontFamily" ), QVariant( fontFamily ) ).toString(); // make sure family exists on system if ( fontFamily != mDefaultFont.family() ) { QFont tempFont( fontFamily ); if ( tempFont.family() != fontFamily ) { // missing from system, drop back to default fontFamily = mDefaultFont.family(); } } QgsDebugMsg( QStringLiteral( "fontFamily: %1" ).arg( fontFamily ) ); opts.insert( QStringLiteral( "fontFamily" ), QVariant( fontFamily ) ); bool gbxCustom = ( mMacStyle ); opts.insert( QStringLiteral( "groupBoxCustom" ), settings.value( QStringLiteral( "groupBoxCustom" ), QVariant( gbxCustom ) ) ); opts.insert( QStringLiteral( "toolbarSpacing" ), settings.value( QStringLiteral( "toolbarSpacing" ), QString() ) ); settings.endGroup(); // "qgis/stylesheet" opts.insert( QStringLiteral( "iconSize" ), settings.value( QStringLiteral( "/qgis/iconSize" ), QGIS_ICON_SIZE ) ); return opts; }
void QgisAppStyleSheet::saveToSettings( const QMap<QString, QVariant> &opts ) { QgsSettings settings; settings.beginGroup( QStringLiteral( "qgis/stylesheet" ) ); QMap<QString, QVariant>::const_iterator opt = opts.constBegin(); while ( opt != opts.constEnd() ) { settings.setValue( QString( opt.key() ), opt.value() ); ++opt; } settings.endGroup(); // "qgis/stylesheet" }
void QgsOgrSourceSelect::populateConnectionList() { QgsSettings settings; settings.beginGroup( '/' + cmbDatabaseTypes->currentText() + "/connections" ); QStringList keys = settings.childGroups(); QStringList::Iterator it = keys.begin(); cmbConnections->clear(); while ( it != keys.end() ) { cmbConnections->addItem( *it ); ++it; } settings.endGroup(); setConnectionListPosition(); }
void QgsCoordinateTransformContext::readSettings() { d.detach(); d->mLock.lockForWrite(); d->mSourceDestDatumTransforms.clear(); #if 0 d->mSourceDatumTransforms.clear(); d->mDestDatumTransforms.clear(); #endif QgsSettings settings; settings.beginGroup( QStringLiteral( "/Projections" ) ); QStringList projectionKeys = settings.allKeys(); //collect src and dest entries that belong together QMap< QPair< QString, QString >, QPair< int, int > > transforms; QStringList::const_iterator pkeyIt = projectionKeys.constBegin(); for ( ; pkeyIt != projectionKeys.constEnd(); ++pkeyIt ) { if ( pkeyIt->contains( QLatin1String( "srcTransform" ) ) || pkeyIt->contains( QLatin1String( "destTransform" ) ) ) { QStringList split = pkeyIt->split( '/' ); QString srcAuthId, destAuthId; if ( ! split.isEmpty() ) { srcAuthId = split.at( 0 ); } if ( split.size() > 1 ) { destAuthId = split.at( 1 ).split( '_' ).at( 0 ); } QString proj = settings.value( *pkeyIt ).toString(); Q_NOWARN_DEPRECATED_PUSH int datumId = QgsDatumTransform::projStringToDatumTransformId( proj ); Q_NOWARN_DEPRECATED_POP if ( pkeyIt->contains( QLatin1String( "srcTransform" ) ) ) { transforms[ qMakePair( srcAuthId, destAuthId )].first = datumId; } else if ( pkeyIt->contains( QLatin1String( "destTransform" ) ) ) { transforms[ qMakePair( srcAuthId, destAuthId )].second = datumId; } } }
QStringList QgsOwsConnection::connectionList( const QString &service ) { QgsSettings settings; settings.beginGroup( "qgis/connections-" + service.toLower() ); return settings.childGroups(); }
QStringList QgsSpatiaLiteConnection::connectionList() { QgsSettings settings; settings.beginGroup( QStringLiteral( "SpatiaLite/connections" ) ); return settings.childGroups(); }
QStringList QgsGeoPackageConnection::connectionList() { QgsSettings settings; settings.beginGroup( connectionsPath( ) ); return settings.childGroups(); }
QgsNewSpatialiteLayerDialog::QgsNewSpatialiteLayerDialog( QWidget *parent, Qt::WindowFlags fl, const QgsCoordinateReferenceSystem &defaultCrs ) : QDialog( parent, fl ) { setupUi( this ); connect( mAddAttributeButton, &QToolButton::clicked, this, &QgsNewSpatialiteLayerDialog::mAddAttributeButton_clicked ); connect( mRemoveAttributeButton, &QToolButton::clicked, this, &QgsNewSpatialiteLayerDialog::mRemoveAttributeButton_clicked ); connect( mTypeBox, static_cast<void ( QComboBox::* )( int )>( &QComboBox::currentIndexChanged ), this, &QgsNewSpatialiteLayerDialog::mTypeBox_currentIndexChanged ); connect( pbnFindSRID, &QPushButton::clicked, this, &QgsNewSpatialiteLayerDialog::pbnFindSRID_clicked ); connect( toolButtonNewDatabase, &QToolButton::clicked, this, &QgsNewSpatialiteLayerDialog::toolButtonNewDatabase_clicked ); connect( buttonBox, &QDialogButtonBox::accepted, this, &QgsNewSpatialiteLayerDialog::buttonBox_accepted ); connect( buttonBox, &QDialogButtonBox::rejected, this, &QgsNewSpatialiteLayerDialog::buttonBox_rejected ); QgsSettings settings; restoreGeometry( settings.value( QStringLiteral( "Windows/NewSpatiaLiteLayer/geometry" ) ).toByteArray() ); mGeometryTypeBox->addItem( tr( "Point" ), QStringLiteral( "POINT" ) ); mGeometryTypeBox->addItem( tr( "Line" ), QStringLiteral( "LINE" ) ); mGeometryTypeBox->addItem( tr( "Polygon" ), QStringLiteral( "POLYGON" ) ); mGeometryTypeBox->addItem( tr( "MultiPoint" ), QStringLiteral( "MULTIPOINT" ) ); mGeometryTypeBox->addItem( tr( "MultiLine" ), QStringLiteral( "MULTILINE" ) ); mGeometryTypeBox->addItem( tr( "MultiPolygon" ), QStringLiteral( "MULTIPOLYGON" ) ); mAddAttributeButton->setIcon( QgsApplication::getThemeIcon( QStringLiteral( "/mActionNewAttribute.svg" ) ) ); mRemoveAttributeButton->setIcon( QgsApplication::getThemeIcon( QStringLiteral( "/mActionDeleteAttribute.svg" ) ) ); mTypeBox->addItem( tr( "Text data" ), "text" ); mTypeBox->addItem( tr( "Whole number" ), "integer" ); mTypeBox->addItem( tr( "Decimal number" ), "real" ); // Populate the database list from the stored connections settings.beginGroup( QStringLiteral( "SpatiaLite/connections" ) ); QStringList keys = settings.childGroups(); QStringList::Iterator it = keys.begin(); mDatabaseComboBox->clear(); while ( it != keys.end() ) { // retrieving the SQLite DB name and full path QString text = settings.value( *it + "/sqlitepath", "###unknown###" ).toString(); mDatabaseComboBox->addItem( text ); ++it; } settings.endGroup(); mOkButton = buttonBox->button( QDialogButtonBox::Ok ); mOkButton->setEnabled( false ); // Set the SRID box to a default of WGS84 mCrsId = defaultCrs.authid(); leSRID->setText( defaultCrs.authid() + " - " + defaultCrs.description() ); pbnFindSRID->setEnabled( mDatabaseComboBox->count() ); connect( mNameEdit, &QLineEdit::textChanged, this, &QgsNewSpatialiteLayerDialog::nameChanged ); connect( mAttributeView, &QTreeWidget::itemSelectionChanged, this, &QgsNewSpatialiteLayerDialog::selectionChanged ); connect( leLayerName, &QLineEdit::textChanged, this, &QgsNewSpatialiteLayerDialog::checkOk ); connect( checkBoxPrimaryKey, &QAbstractButton::clicked, this, &QgsNewSpatialiteLayerDialog::checkOk ); connect( buttonBox, &QDialogButtonBox::helpRequested, this, &QgsNewSpatialiteLayerDialog::showHelp ); mAddAttributeButton->setEnabled( false ); mRemoveAttributeButton->setEnabled( false ); }