本文整理汇总了C++中QSettings函数的典型用法代码示例。如果您正苦于以下问题:C++ QSettings函数的具体用法?C++ QSettings怎么用?C++ QSettings使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了QSettings函数的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: QDialog
QgsNewVectorLayerDialog::QgsNewVectorLayerDialog( QWidget *parent, const Qt::WindowFlags& fl )
: QDialog( parent, fl )
{
setupUi( this );
QSettings settings;
restoreGeometry( settings.value( "/Windows/NewVectorLayer/geometry" ).toByteArray() );
mAddAttributeButton->setIcon( QgsApplication::getThemeIcon( "/mActionNewAttribute.png" ) );
mRemoveAttributeButton->setIcon( QgsApplication::getThemeIcon( "/mActionDeleteAttribute.png" ) );
mTypeBox->addItem( tr( "Text data" ), "String" );
mTypeBox->addItem( tr( "Whole number" ), "Integer" );
mTypeBox->addItem( tr( "Decimal number" ), "Real" );
mTypeBox->addItem( tr( "Date" ), "Date" );
mWidth->setValidator( new QIntValidator( 1, 255, this ) );
mPrecision->setValidator( new QIntValidator( 0, 15, this ) );
mPointRadioButton->setChecked( true );
mFileFormatComboBox->addItem( tr( "ESRI Shapefile" ), "ESRI Shapefile" );
#if 0
// Disabled until provider properly supports editing the created file formats
mFileFormatComboBox->addItem( tr( "Comma Separated Value" ), "Comma Separated Value" );
mFileFormatComboBox->addItem( tr( "GML" ), "GML" );
mFileFormatComboBox->addItem( tr( "Mapinfo File" ), "Mapinfo File" );
#endif
if ( mFileFormatComboBox->count() == 1 )
{
mFileFormatComboBox->setVisible( false );
mFileFormatLabel->setVisible( false );
}
mFileFormatComboBox->setCurrentIndex( 0 );
mFileEncoding->addItems( QgsVectorDataProvider::availableEncodings() );
// Use default encoding if none supplied
QString enc = QSettings().value( "/UI/encoding", "System" ).toString();
// The specified decoding is added if not existing alread, and then set current.
// This should select it.
int encindex = mFileEncoding->findText( enc );
if ( encindex < 0 )
{
mFileEncoding->insertItem( 0, enc );
encindex = 0;
}
mFileEncoding->setCurrentIndex( encindex );
mOkButton = buttonBox->button( QDialogButtonBox::Ok );
mAttributeView->addTopLevelItem( new QTreeWidgetItem( QStringList() << "id" << "Integer" << "10" << "" ) );
QgsCoordinateReferenceSystem defaultCrs;
defaultCrs.createFromOgcWmsCrs( settings.value( "/Projections/layerDefaultCrs", GEO_EPSG_CRS_AUTHID ).toString() );
defaultCrs.validate();
mCrsSelector->setCrs( defaultCrs );
connect( mNameEdit, SIGNAL( textChanged( QString ) ), this, SLOT( nameChanged( QString ) ) );
connect( mAttributeView, SIGNAL( itemSelectionChanged() ), this, SLOT( selectionChanged() ) );
mAddAttributeButton->setEnabled( false );
mRemoveAttributeButton->setEnabled( false );
}
开发者ID:stevenmizuno,项目名称:QGIS,代码行数:64,代码来源:qgsnewvectorlayerdialog.cpp
示例2: applicationSettingValue
static QVariant applicationSettingValue(const QString &appRoot, const QString &key)
{
QString appIni = appRoot + QDir::separator() + QLatin1String("config") + QDir::separator() + "application.ini";
return QSettings(appIni, QSettings::IniFormat).value(key);
}
开发者ID:dragondjf,项目名称:treefrog-framework,代码行数:5,代码来源:main.cpp
示例3: QSettings
void Config::restoreDefaultsConfig()
{
QSettings(ConfigFilePath(), QSettings::IniFormat).clear();
}
开发者ID:Answeror,项目名称:ezviewer,代码行数:4,代码来源:config.cpp
示例4: ogrLayer
QgsOgrFeatureIterator::QgsOgrFeatureIterator( QgsOgrFeatureSource* source, bool ownSource, const QgsFeatureRequest& request )
: QgsAbstractFeatureIteratorFromSource<QgsOgrFeatureSource>( source, ownSource, request )
, ogrLayer( 0 )
, mSubsetStringSet( false )
, mGeometrySimplifier( NULL )
, mExpressionCompiled( false )
{
mFeatureFetched = false;
mConn = QgsOgrConnPool::instance()->acquireConnection( mSource->mFilePath );
if ( mSource->mLayerName.isNull() )
{
ogrLayer = OGR_DS_GetLayer( mConn->ds, mSource->mLayerIndex );
}
else
{
ogrLayer = OGR_DS_GetLayerByName( mConn->ds, TO8( mSource->mLayerName ) );
}
if ( !mSource->mSubsetString.isEmpty() )
{
ogrLayer = QgsOgrUtils::setSubsetString( ogrLayer, mConn->ds, mSource->mEncoding, mSource->mSubsetString );
mSubsetStringSet = true;
}
mFetchGeometry = ( !mRequest.filterRect().isNull() ) || !( mRequest.flags() & QgsFeatureRequest::NoGeometry );
QgsAttributeList attrs = ( mRequest.flags() & QgsFeatureRequest::SubsetOfAttributes ) ? mRequest.subsetOfAttributes() : mSource->mFields.allAttributesList();
// make sure we fetch just relevant fields
// unless it's a VRT data source filtered by geometry as we don't know which
// attributes make up the geometry and OGR won't fetch them to evaluate the
// filter if we choose to ignore them (fixes #11223)
if (( mSource->mDriverName != "VRT" && mSource->mDriverName != "OGR_VRT" ) || mRequest.filterRect().isNull() )
{
QgsOgrUtils::setRelevantFields( ogrLayer, mSource->mFields.count(), mFetchGeometry, attrs );
}
// spatial query to select features
if ( !mRequest.filterRect().isNull() )
{
const QgsRectangle& rect = mRequest.filterRect();
OGR_L_SetSpatialFilterRect( ogrLayer, rect.xMinimum(), rect.yMinimum(), rect.xMaximum(), rect.yMaximum() );
}
else
{
OGR_L_SetSpatialFilter( ogrLayer, 0 );
}
if ( request.filterType() == QgsFeatureRequest::FilterExpression
&& QSettings().value( "/qgis/compileExpressions", true ).toBool() )
{
QgsOgrExpressionCompiler compiler = QgsOgrExpressionCompiler( source );
QgsSqlExpressionCompiler::Result result = compiler.compile( request.filterExpression() );
if ( result == QgsSqlExpressionCompiler::Complete || result == QgsSqlExpressionCompiler::Partial )
{
QString whereClause = compiler.result();
if ( OGR_L_SetAttributeFilter( ogrLayer, whereClause.toLocal8Bit().data() ) == OGRERR_NONE )
{
//if only partial success when compiling expression, we need to double-check results using QGIS' expressions
mExpressionCompiled = ( result == QgsSqlExpressionCompiler::Complete );
}
}
else
{
OGR_L_SetAttributeFilter( ogrLayer, 0 );
}
}
else
{
OGR_L_SetAttributeFilter( ogrLayer, 0 );
}
//start with first feature
rewind();
}
开发者ID:stevenmizuno,项目名称:QGIS,代码行数:79,代码来源:qgsogrfeatureiterator.cpp
示例5: config
void QgsRangeWidgetWrapper::initWidget( QWidget* editor )
{
mDoubleSpinBox = qobject_cast<QDoubleSpinBox*>( editor );
mIntSpinBox = qobject_cast<QSpinBox*>( editor );
mDial = qobject_cast<QDial*>( editor );
mSlider = qobject_cast<QSlider*>( editor );
mQgsDial = qobject_cast<QgsDial*>( editor );
mQgsSlider = qobject_cast<QgsSlider*>( editor );
bool allowNull = config( "AllowNull" ).toBool();
QVariant min( config( "Min" ) );
QVariant max( config( "Max" ) );
QVariant step( config( "Step" ) );
if ( mDoubleSpinBox )
{
// set the precision if field is integer
int precision = layer()->fields()[fieldIdx()].precision();
if ( precision > 0 )
{
mDoubleSpinBox->setDecimals( layer()->fields()[fieldIdx()].precision() );
}
double minval = min.toDouble();
double stepval = step.toDouble();
QgsDoubleSpinBox* qgsWidget = dynamic_cast<QgsDoubleSpinBox*>( mDoubleSpinBox );
if ( qgsWidget )
qgsWidget->setShowClearButton( allowNull );
if ( allowNull )
{
if ( precision > 0 )
{
minval -= 10 ^ -precision;
}
else
{
minval -= stepval;
}
mDoubleSpinBox->setValue( minval );
mDoubleSpinBox->setSpecialValueText( QSettings().value( "qgis/nullValue", "NULL" ).toString() );
}
if ( min.isValid() )
mDoubleSpinBox->setMinimum( min.toDouble() );
if ( max.isValid() )
mDoubleSpinBox->setMaximum( max.toDouble() );
if ( step.isValid() )
mDoubleSpinBox->setSingleStep( step.toDouble() );
if ( config( "Suffix" ).isValid() )
mDoubleSpinBox->setSuffix( config( "Suffix" ).toString() );
connect( mDoubleSpinBox, SIGNAL( valueChanged( double ) ), this, SLOT( valueChanged( double ) ) );
}
if ( mIntSpinBox )
{
int minval = min.toInt();
int stepval = step.toInt();
QgsSpinBox* qgsWidget = dynamic_cast<QgsSpinBox*>( mIntSpinBox );
if ( qgsWidget )
qgsWidget->setShowClearButton( allowNull );
if ( allowNull )
{
minval -= stepval;
mIntSpinBox->setValue( minval );
mIntSpinBox->setSpecialValueText( QSettings().value( "qgis/nullValue", "NULL" ).toString() );
}
if ( min.isValid() )
mIntSpinBox->setMinimum( min.toInt() );
if ( max.isValid() )
mIntSpinBox->setMaximum( max.toInt() );
if ( step.isValid() )
mIntSpinBox->setSingleStep( step.toInt() );
if ( config( "Suffix" ).isValid() )
mIntSpinBox->setSuffix( config( "Suffix" ).toString() );
connect( mIntSpinBox, SIGNAL( valueChanged( int ) ), this, SLOT( valueChanged( int ) ) );
}
if ( mQgsDial || mQgsSlider )
{
field().convertCompatible( min );
field().convertCompatible( max );
field().convertCompatible( step );
if ( mQgsSlider )
{
if ( min.isValid() )
mQgsSlider->setMinimum( min );
if ( max.isValid() )
mQgsSlider->setMaximum( max );
if ( step.isValid() )
mQgsSlider->setSingleStep( step );
}
if ( mQgsDial )
{
if ( min.isValid() )
mQgsDial->setMinimum( min );
if ( max.isValid() )
//.........这里部分代码省略.........
开发者ID:spatialthoughts,项目名称:QGIS,代码行数:101,代码来源:qgsrangewidgetwrapper.cpp
示例6: QSettings
void Clock::stop() {
m_stopped = true;
m_clock_timer->stop();
QSettings().remove("Current/Time");
updateText();
}
开发者ID:VitalD,项目名称:connectagram,代码行数:6,代码来源:clock.cpp
注:本文中的QSettings函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论