void QgsGraduatedSymbolRendererV2Widget::updateUiFromRenderer() { updateGraduatedSymbolIcon(); // update UI from the graduated renderer (update combo boxes, view) if ( mRenderer->mode() < cboGraduatedMode->count() ) cboGraduatedMode->setCurrentIndex( mRenderer->mode() ); if ( mRenderer->ranges().count() ) spinGraduatedClasses->setValue( mRenderer->ranges().count() ); // set column disconnect( mExpressionWidget, SIGNAL( fieldChanged( QString ) ), this, SLOT( graduatedColumnChanged( QString ) ) ); QString attrName = mRenderer->classAttribute(); mExpressionWidget->setField( attrName ); connect( mExpressionWidget, SIGNAL( fieldChanged( QString ) ), this, SLOT( graduatedColumnChanged( QString ) ) ); // set source symbol if ( mRenderer->sourceSymbol() ) { delete mGraduatedSymbol; mGraduatedSymbol = mRenderer->sourceSymbol()->clone(); updateGraduatedSymbolIcon(); } // set source color ramp if ( mRenderer->sourceColorRamp() ) { cboGraduatedColorRamp->setSourceColorRamp( mRenderer->sourceColorRamp() ); cbxInvertedColorRamp->setChecked( mRenderer->invertedColorRamp() ); } }
QgsFieldConditionalFormatWidget::QgsFieldConditionalFormatWidget( QWidget *parent ) : QWidget( parent ) , mLayer( 0 ) , mEditIndex( 0 ) , mEditing( false ) , mSymbol( 0 ) { setupUi( this ); mDeleteButton->hide(); connect( mFieldCombo, SIGNAL( fieldChanged( QString ) ), SLOT( fieldChanged( QString ) ) ); connect( fieldRadio, SIGNAL( clicked() ), SLOT( reloadStyles() ) ); connect( rowRadio, SIGNAL( clicked() ), SLOT( reloadStyles() ) ); connect( mNewButton, SIGNAL( clicked() ), SLOT( addNewRule() ) ); connect( mSaveRule, SIGNAL( clicked() ), SLOT( saveRule() ) ); connect( mCancelButton, SIGNAL( clicked() ), SLOT( cancelRule() ) ); connect( mDeleteButton, SIGNAL( clicked() ), SLOT( deleteRule() ) ); connect( listView, SIGNAL( clicked( QModelIndex ) ), SLOT( ruleClicked( QModelIndex ) ) ); connect( btnChangeIcon , SIGNAL( clicked() ), SLOT( updateIcon() ) ); connect( btnBuildExpression , SIGNAL( clicked() ), SLOT( setExpression() ) ); connect( mPresetsList , SIGNAL( currentIndexChanged( int ) ), SLOT( presetSet( int ) ) ); btnBackgroundColor->setAllowAlpha( true ); btnBackgroundColor->setShowNoColor( true ); btnTextColor->setAllowAlpha( true ); btnTextColor->setShowNoColor( true ); mPresetsModel = new QStandardItemModel( listView ); mModel = new QStandardItemModel( listView ); listView->setModel( mModel ); mPresetsList->setModel( mPresetsModel ); setPresets( defaultPresets() ); }
void QgsFieldExpressionWidget::currentFieldChanged( int i /* =0 */ ) { Q_UNUSED( i ); updateLineEditStyle(); bool isExpression, isValid; QString fieldName = currentField( &isExpression, &isValid ); emit fieldChanged( fieldName ); emit fieldChanged( fieldName, isValid ); }
void av::MultiField<uint64_t>::pop(av::Msg& msg) { av_popMsg(msg, mValue); if(mHasSetValueCallback) mSetValueCallback(SetValueEvent(this, mValue)); fieldChanged(true); }
QWidget * MLABOsiriXBridgeControl::createWidget(QWidget *parent) { #if defined(MACOS) if (parent) { QWidget *window = parent->window(); _p = new MLABOsiriXBridgeWindowDelegate(this, window); MLABTree *attrib; CONTROL_FIND_LOCAL(attrib, QLatin1String("windowFilePathField")); if (attrib) { _windowFilePathField = lookupField(attrib); if (_windowFilePathField) { MLABFIELD_ADD_OBSERVER(_windowFilePathField, this, fieldChanged); fieldChanged(); } } static QMap<QString,QString> commands; commands.insert(QLatin1String("droppedSeriesCommand"), QLatin1String("seriesDropped(const QVariant &)")); MLABScriptSignalHandler::setupSignalHandlers(_tree, this, _module, _windowId, commands); } #endif return NULL; }
VectorDialog::VectorDialog(ObjectPtr dataObject, QWidget *parent) : DataDialog(dataObject, parent) { if (editMode() == Edit) setWindowTitle(tr("Edit Vector")); else setWindowTitle(tr("New Vector")); Q_ASSERT(_document); _vectorTab = new VectorTab(_document->objectStore(), this); addDataTab(_vectorTab); if (editMode() == Edit) { configureTab(dataObject); } else { configureTab(0); } connect(_vectorTab, SIGNAL(sourceChanged()), this, SLOT(updateButtons())); connect(_vectorTab, SIGNAL(fieldChanged()), this, SLOT(updateButtons())); connect(this, SIGNAL(editMultipleMode()), this, SLOT(editMultipleMode())); connect(this, SIGNAL(editSingleMode()), this, SLOT(editSingleMode())); connect(_vectorTab, SIGNAL(modified()), this, SLOT(modified())); updateButtons(); }
QgsStatisticalSummaryDockWidget::QgsStatisticalSummaryDockWidget( QWidget *parent ) : QDockWidget( parent ) , mLayer( 0 ) { setupUi( this ); mLayerComboBox->setFilters( QgsMapLayerProxyModel::VectorLayer ); mFieldExpressionWidget->setFilters( QgsFieldProxyModel::Numeric ); connect( mLayerComboBox, SIGNAL( layerChanged( QgsMapLayer* ) ), this, SLOT( layerChanged( QgsMapLayer* ) ) ); connect( mFieldExpressionWidget, SIGNAL( fieldChanged( QString ) ), this, SLOT( refreshStatistics() ) ); connect( mSelectedOnlyCheckBox, SIGNAL( toggled( bool ) ), this, SLOT( refreshStatistics() ) ); connect( mButtonRefresh, SIGNAL( clicked( bool ) ), this, SLOT( refreshStatistics() ) ); if ( mLayerComboBox->currentLayer() ) { mFieldExpressionWidget->setLayer( mLayerComboBox->currentLayer() ); } QSettings settings; foreach ( QgsStatisticalSummary::Statistic stat, mDisplayStats ) { QAction* action = new QAction( QgsStatisticalSummary::displayName( stat ), mOptionsToolButton ); action->setCheckable( true ); bool checked = settings.value( QString( "/StatisticalSummaryDock/checked_%1" ).arg( stat ), true ).toBool(); action->setChecked( checked ); action->setData( stat ); mStatsActions.insert( stat, action ); connect( action, SIGNAL( triggered( bool ) ), this, SLOT( statActionTriggered( bool ) ) ); mOptionsToolButton->addAction( action ); }
VectorTab::VectorTab(ObjectStore *store, QWidget *parent) : DataTab(parent), validating(false), _mode(DataVector), _store(store), _initField(QString()), _requestID(0), _valid(false) { setupUi(this); setTabTitle(tr("Vector")); connect(_generatedVectorGroup, SIGNAL(clicked(bool)), this, SLOT(generateClicked())); connect(_dataVectorGroup, SIGNAL(clicked(bool)), this, SLOT(readFromSourceClicked())); connect(_fileName, SIGNAL(changed(QString)), this, SLOT(fileNameChanged(QString))); connect(_configure, SIGNAL(clicked()), this, SLOT(showConfigWidget())); connect(_field, SIGNAL(editTextChanged(QString)), this, SIGNAL(fieldChanged())); connect(_dataRange, SIGNAL(modified()), this, SIGNAL(modified())); connect(_numberOfSamples, SIGNAL(valueChanged(int)), this, SIGNAL(modified())); connect(_from, SIGNAL(textChanged(QString)), this, SIGNAL(modified())); connect(_to, SIGNAL(textChanged(QString)), this, SIGNAL(modified())); // embed data range in the data source box _dataRange->groupBox2->setFlat(true); _dataRange->groupBox2->setTitle(""); int top_margin; _dataRange->groupBox2->layout()->getContentsMargins(NULL,&top_margin,NULL,NULL); _dataRange->groupBox2->layout()->setContentsMargins(0,top_margin,0,0); _connect->setVisible(false); _updateBox->addItem(tr("Time Interval", "update periodically")); _updateBox->addItem(tr("Change Detection", "update when a change is detected")); _updateBox->addItem(tr("No Update", "do not update the file")); updateUpdateBox(); connect(_updateBox, SIGNAL(currentIndexChanged(int)), this, SLOT(updateTypeActivated(int))); connect(_updateBox, SIGNAL(currentIndexChanged(int)), this, SIGNAL(modified())); }
QgsStatisticalSummaryDockWidget::QgsStatisticalSummaryDockWidget( QWidget *parent ) : QgsDockWidget( parent ) , mLayer( nullptr ) { setupUi( this ); mFieldExpressionWidget->registerExpressionContextGenerator( this ); mLayerComboBox->setFilters( QgsMapLayerProxyModel::VectorLayer ); mFieldExpressionWidget->setFilters( QgsFieldProxyModel::Numeric | QgsFieldProxyModel::String | QgsFieldProxyModel::Date ); mLayerComboBox->setLayer( mLayerComboBox->layer( 0 ) ); mFieldExpressionWidget->setLayer( mLayerComboBox->layer( 0 ) ); connect( mLayerComboBox, SIGNAL( layerChanged( QgsMapLayer* ) ), this, SLOT( layerChanged( QgsMapLayer* ) ) ); connect( mFieldExpressionWidget, SIGNAL( fieldChanged( QString ) ), this, SLOT( refreshStatistics() ) ); connect( mSelectedOnlyCheckBox, SIGNAL( toggled( bool ) ), this, SLOT( refreshStatistics() ) ); connect( mButtonRefresh, SIGNAL( clicked( bool ) ), this, SLOT( refreshStatistics() ) ); connect( QgsProject::instance(), SIGNAL( layersWillBeRemoved( QStringList ) ), this, SLOT( layersRemoved( QStringList ) ) ); QSettings settings; Q_FOREACH ( QgsStatisticalSummary::Statistic stat, mDisplayStats ) { QAction* action = new QAction( QgsStatisticalSummary::displayName( stat ), mOptionsToolButton ); action->setCheckable( true ); bool checked = settings.value( QStringLiteral( "/StatisticalSummaryDock/checked_%1" ).arg( stat ), true ).toBool(); action->setChecked( checked ); action->setData( stat ); mStatsActions.insert( stat, action ); connect( action, SIGNAL( triggered( bool ) ), this, SLOT( statActionTriggered( bool ) ) ); mOptionsToolButton->addAction( action ); }
template<> void av::MultiField<double>::pop(av::Msg& msg) { av_popMsg(msg, mValue); if (mHasSetValueCallback) mSetValueCallback(SetValueEvent(this, mValue)); fieldChanged(true); }
void AlphabeticalSorterInterface::setField(const QString &field) { Q_D(AlphabeticalSorterInterface); if (d->field != field) { d->field = field; emit fieldChanged(); } }
/***************************************************************************\ * Instance methods * \***************************************************************************/ bool FieldEditorComponent::attachField(FieldContainer* fc, UInt32 fieldId, UInt32 index) { //Cancel current editing cancelEditing(); //Check that this is a valid FieldContainer if(fc == NULL) { SWARNING << "Cannot attach to a Null FieldContainer." << std::endl; return false; } //Check that this is a valid FieldId const FieldDescriptionBase* Desc(fc->getFieldDescription(fieldId)); if(Desc == NULL) { SWARNING << "Cannot attach to field with id " << fieldId << ", on a FieldContainer with type " << fc->getType().getCName() << " because that is an invalid field id." << std::endl; return false; } //Check that this is a type to edit for this editor if(!isTypeEditable(Desc->getFieldType().getContentType())) { SWARNING << " Cannot attach to field " << Desc->getCName() << ", with content type " << Desc->getFieldType().getContentType().getCName() << " because that content type is not supported by this editor type." << std::endl; return false; } //Check that this is a valid index GetFieldHandlePtr TheFieldHandle = fc->getField(fieldId); if(!TheFieldHandle.get()) { SWARNING << "Cannot attach to field " << Desc->getCName() << ", on a FieldContainer with type " << fc->getType().getCName() << " because no GetFieldHandle is defined for that field type." << std::endl; return false; } if(!internalAttachField(fc, fieldId, index)) { return false; } //Attach to the field setEditingFC(fc); setEditingFieldId(fieldId); //Tell the Editor that the field has changed fieldChanged(fc, Desc->getFieldMask()); //Attach to the Changed function callback for the container attachFieldCallback(); return true; }
void QgsFieldExpressionWidget::currentFieldChanged() { updateLineEditStyle(); bool isExpression, isValid; QString fieldName = currentField( &isExpression, &isValid ); // display tooltip if widget is shorter than expression QFontMetrics metrics( mCombo->lineEdit()->font() ); if ( metrics.width( fieldName ) > mCombo->lineEdit()->width() ) { mCombo->setToolTip( fieldName ); } else { mCombo->setToolTip( "" ); } emit fieldChanged( fieldName ); emit fieldChanged( fieldName, isValid ); }
QWidget* QgsComposerColumnSourceDelegate::createEditor( QWidget* parent, const QStyleOptionViewItem& option, const QModelIndex& index ) const { Q_UNUSED( option ); Q_UNUSED( index ); QgsFieldExpressionWidget *fieldExpression = new QgsFieldExpressionWidget( parent ); fieldExpression->setLayer( mVectorLayer ); //listen out for field changes connect( fieldExpression, SIGNAL( fieldChanged( QString ) ), this, SLOT( commitAndCloseEditor() ) ); return fieldExpression; }
Qgs25DRendererWidget::Qgs25DRendererWidget( QgsVectorLayer* layer, QgsStyleV2* style, QgsFeatureRendererV2* renderer ) : QgsRendererV2Widget( layer, style ) , mRenderer( nullptr ) { if ( !layer ) return; // the renderer only applies to point vector layers if ( layer->geometryType() != QGis::Polygon ) { //setup blank dialog QGridLayout* layout = new QGridLayout( this ); QLabel* label = new QLabel( tr( "The 2.5D renderer only can be used with polygon layers. \n" "'%1' is not a polygon layer and cannot be rendered in 2.5D." ) .arg( layer->name() ), this ); layout->addWidget( label ); return; } setupUi( this ); if ( renderer ) { mRenderer = Qgs25DRenderer::convertFromRenderer( renderer ); } mHeightWidget->setLayer( layer ); QgsExpressionContextScope* scope = QgsExpressionContextUtils::layerScope( mLayer ); QVariant height = scope->variable( "qgis_25d_height" ); QVariant angle = scope->variable( "qgis_25d_angle" ); delete scope; mHeightWidget->setField( height.isNull() ? "10" : height.toString() ); mAngleWidget->setValue( angle.isNull() ? 70 : angle.toDouble() ); mWallColorButton->setColor( mRenderer->wallColor() ); mRoofColorButton->setColor( mRenderer->roofColor() ); mShadowColorButton->setColor( mRenderer->shadowColor() ); mShadowEnabledWidget->setChecked( mRenderer->shadowEnabled() ); mShadowSizeWidget->setValue( mRenderer->shadowSpread() ); mWallExpositionShading->setChecked( mRenderer->wallShadingEnabled() ); connect( mAngleWidget, SIGNAL( valueChanged( int ) ), this, SLOT( updateRenderer() ) ); connect( mHeightWidget, SIGNAL( fieldChanged( QString ) ), this, SLOT( updateRenderer() ) ); connect( mWallColorButton, SIGNAL( colorChanged( QColor ) ), this, SLOT( updateRenderer() ) ); connect( mRoofColorButton, SIGNAL( colorChanged( QColor ) ), this, SLOT( updateRenderer() ) ); connect( mShadowColorButton, SIGNAL( colorChanged( QColor ) ), this, SLOT( updateRenderer() ) ); connect( mShadowEnabledWidget, SIGNAL( toggled( bool ) ), this, SLOT( updateRenderer() ) ); connect( mShadowSizeWidget, SIGNAL( valueChanged( double ) ), this, SLOT( updateRenderer() ) ); connect( mWallExpositionShading, SIGNAL( toggled( bool ) ), this, SLOT( updateRenderer() ) ); }
void QgsFieldComboBox::setField( const QString& fieldName ) { QModelIndex idx = mFieldProxyModel->sourceFieldModel()->indexFromName( fieldName ); if ( idx.isValid() ) { QModelIndex proxyIdx = mFieldProxyModel->mapFromSource( idx ); if ( proxyIdx.isValid() ) { setCurrentIndex( idx.row() ); emit fieldChanged( currentField() ); return; } } setCurrentIndex( -1 ); }
void TunerFrame::adjustFreq(double frq) { const double factor = 13.0 / (108 - 87.5); const double x = (frq - 87.5) * factor; const double field = qwtSqr(sin(x) * cos(4.0 * x)); d_thmTune->setValue(field); if (d_sldFreq->value() != frq) d_sldFreq->setValue(frq); if (d_whlFreq->value() != frq) d_whlFreq->setValue(frq); emit fieldChanged(field); }
int TunerFrame::qt_metacall(QMetaObject::Call _c, int _id, void **_a) { _id = QFrame::qt_metacall(_c, _id, _a); if (_id < 0) return _id; if (_c == QMetaObject::InvokeMetaMethod) { switch (_id) { case 0: fieldChanged((*reinterpret_cast< double(*)>(_a[1]))); break; case 1: setFreq((*reinterpret_cast< double(*)>(_a[1]))); break; case 2: adjustFreq((*reinterpret_cast< double(*)>(_a[1]))); break; default: ; } _id -= 3; } return _id; }
void TunerFrame::adjustFreq( double frq ) { const double factor = 13.0 / ( 108 - 87.5 ); const double x = ( frq - 87.5 ) * factor; const double field = qwtSqr( qFastSin( x ) * qFastCos( 4.0 * x ) ); d_thermoTune->setValue( field ); if ( d_sliderFrequency->value() != frq ) d_sliderFrequency->setValue( frq ); if ( d_wheelFrequency->value() != frq ) d_wheelFrequency->setValue( frq ); Q_EMIT fieldChanged( field ); }
QgsAtlasCompositionWidget::QgsAtlasCompositionWidget( QWidget* parent, QgsComposition* c ): QWidget( parent ), mComposition( c ) { setupUi( this ); mAtlasCoverageLayerComboBox->setFilters( QgsMapLayerProxyModel::HasGeometry ); mAtlasSortFeatureKeyComboBox->setLayer( mAtlasCoverageLayerComboBox->currentLayer() ); connect( mAtlasCoverageLayerComboBox, SIGNAL( layerChanged( QgsMapLayer* ) ), mAtlasSortFeatureKeyComboBox, SLOT( setLayer( QgsMapLayer* ) ) ); connect( mAtlasCoverageLayerComboBox, SIGNAL( layerChanged( QgsMapLayer* ) ), this, SLOT( changeCoverageLayer( QgsMapLayer* ) ) ); connect( mAtlasSortFeatureKeyComboBox, SIGNAL( fieldChanged( QString ) ), this, SLOT( changesSortFeatureField( QString ) ) ); // Sort direction mAtlasSortFeatureDirectionButton->setEnabled( false ); mAtlasSortFeatureKeyComboBox->setEnabled( false ); // connect to updates connect( &mComposition->atlasComposition(), SIGNAL( parameterChanged() ), this, SLOT( updateGuiElements() ) ); updateGuiElements(); }
QgsAtlasCompositionWidget::QgsAtlasCompositionWidget( QWidget* parent, QgsComposition* c ): QWidget( parent ), mComposition( c ) { setupUi( this ); mAtlasCoverageLayerComboBox->setFilters( QgsMapLayerProxyModel::VectorLayer ); connect( mAtlasCoverageLayerComboBox, SIGNAL( layerChanged( QgsMapLayer* ) ), mAtlasSortFeatureKeyComboBox, SLOT( setLayer( QgsMapLayer* ) ) ); connect( mAtlasCoverageLayerComboBox, SIGNAL( layerChanged( QgsMapLayer* ) ), mPageNameWidget, SLOT( setLayer( QgsMapLayer* ) ) ); connect( mAtlasCoverageLayerComboBox, SIGNAL( layerChanged( QgsMapLayer* ) ), this, SLOT( changeCoverageLayer( QgsMapLayer* ) ) ); connect( mAtlasSortFeatureKeyComboBox, SIGNAL( fieldChanged( QString ) ), this, SLOT( changesSortFeatureField( QString ) ) ); connect( mPageNameWidget, SIGNAL( fieldChanged( QString, bool ) ), this, SLOT( pageNameExpressionChanged( QString, bool ) ) ); // Sort direction mAtlasSortFeatureDirectionButton->setEnabled( false ); mAtlasSortFeatureKeyComboBox->setEnabled( false ); // connect to updates connect( &mComposition->atlasComposition(), SIGNAL( parameterChanged() ), this, SLOT( updateGuiElements() ) ); mPageNameWidget->registerGetExpressionContextCallback( &_getExpressionContext, mComposition ); updateGuiElements(); }
QgsCategorizedSymbolRendererV2Widget::QgsCategorizedSymbolRendererV2Widget( QgsVectorLayer* layer, QgsStyleV2* style, QgsFeatureRendererV2* renderer ) : QgsRendererV2Widget( layer, style ) , mRenderer( 0 ) , mModel( 0 ) { // try to recognize the previous renderer // (null renderer means "no previous renderer") if ( renderer ) { mRenderer = QgsCategorizedSymbolRendererV2::convertFromRenderer( renderer ); } if ( !mRenderer ) { mRenderer = new QgsCategorizedSymbolRendererV2( "", QgsCategoryList() ); } QString attrName = mRenderer->classAttribute(); mOldClassificationAttribute = attrName; // setup user interface setupUi( this ); mExpressionWidget->setLayer( mLayer ); cboCategorizedColorRamp->populate( mStyle ); int randomIndex = cboCategorizedColorRamp->findText( tr( "Random colors" ) ); if ( randomIndex != -1 ) { cboCategorizedColorRamp->setCurrentIndex( randomIndex ); } // set project default color ramp QString defaultColorRamp = QgsProject::instance()->readEntry( "DefaultStyles", "/ColorRamp", "" ); if ( defaultColorRamp != "" ) { int index = cboCategorizedColorRamp->findText( defaultColorRamp, Qt::MatchCaseSensitive ); if ( index >= 0 ) cboCategorizedColorRamp->setCurrentIndex( index ); } mCategorizedSymbol = QgsSymbolV2::defaultSymbol( mLayer->geometryType() ); mModel = new QgsCategorizedSymbolRendererV2Model( this ); mModel->setRenderer( mRenderer ); // update GUI from renderer updateUiFromRenderer(); viewCategories->setModel( mModel ); viewCategories->resizeColumnToContents( 0 ); viewCategories->resizeColumnToContents( 1 ); viewCategories->resizeColumnToContents( 2 ); viewCategories->setStyle( new QgsCategorizedSymbolRendererV2ViewStyle( viewCategories->style() ) ); connect( mModel, SIGNAL( rowsMoved() ), this, SLOT( rowsMoved() ) ); connect( mExpressionWidget, SIGNAL( fieldChanged( QString ) ), this, SLOT( categoryColumnChanged( QString ) ) ); connect( viewCategories, SIGNAL( doubleClicked( const QModelIndex & ) ), this, SLOT( categoriesDoubleClicked( const QModelIndex & ) ) ); connect( viewCategories, SIGNAL( customContextMenuRequested( const QPoint& ) ), this, SLOT( contextMenuViewCategories( const QPoint& ) ) ); connect( btnChangeCategorizedSymbol, SIGNAL( clicked() ), this, SLOT( changeCategorizedSymbol() ) ); connect( btnAddCategories, SIGNAL( clicked() ), this, SLOT( addCategories() ) ); connect( btnDeleteCategories, SIGNAL( clicked() ), this, SLOT( deleteCategories() ) ); connect( btnDeleteAllCategories, SIGNAL( clicked() ), this, SLOT( deleteAllCategories() ) ); connect( btnAddCategory, SIGNAL( clicked() ), this, SLOT( addCategory() ) ); connect( cbxInvertedColorRamp, SIGNAL( toggled( bool ) ), this, SLOT( applyColorRamp() ) ); connect( cboCategorizedColorRamp, SIGNAL( currentIndexChanged( int ) ), this, SLOT( applyColorRamp() ) ); // menus for data-defined rotation/size QMenu* advMenu = new QMenu; advMenu->addAction( tr( "Symbol levels..." ), this, SLOT( showSymbolLevels() ) ); mDataDefinedMenus = new QgsRendererV2DataDefinedMenus( advMenu, mLayer, mRenderer->rotationField(), mRenderer->sizeScaleField(), mRenderer->scaleMethod() ); connect( mDataDefinedMenus, SIGNAL( rotationFieldChanged( QString ) ), this, SLOT( rotationFieldChanged( QString ) ) ); connect( mDataDefinedMenus, SIGNAL( sizeScaleFieldChanged( QString ) ), this, SLOT( sizeScaleFieldChanged( QString ) ) ); connect( mDataDefinedMenus, SIGNAL( scaleMethodChanged( QgsSymbolV2::ScaleMethod ) ), this, SLOT( scaleMethodChanged( QgsSymbolV2::ScaleMethod ) ) ); btnAdvanced->setMenu( advMenu ); }
QgsSizeScaleWidget::QgsSizeScaleWidget( const QgsVectorLayer * layer, const QgsMarkerSymbolV2 * symbol ) : mSymbol( symbol ) // we just use the minimumValue and maximumValue from the layer, unfortunately they are // non const, so we get the layer from the registry instead , mLayer( layer ? dynamic_cast<QgsVectorLayer *>( QgsMapLayerRegistry::instance()->mapLayer( layer->id() ) ) : 0 ) { setupUi( this ); setWindowFlags( Qt::WindowStaysOnTopHint ); mExpressionWidget->registerGetExpressionContextCallback( &_getExpressionContext, mLayer ); if ( mLayer ) { mLayerTreeLayer = new QgsLayerTreeLayer( mLayer ); mRoot.addChildNode( mLayerTreeLayer ); // takes ownership } else { mLayerTreeLayer = 0; } treeView->setModel( &mPreviewList ); treeView->setItemDelegate( new ItemDelegate( &mPreviewList ) ); treeView->setHeaderHidden( true ); treeView->expandAll(); QAction* computeFromLayer = new QAction( tr( "Compute from layer" ), this ); connect( computeFromLayer, SIGNAL( triggered() ), this, SLOT( computeFromLayerTriggered() ) ); QMenu* menu = new QMenu(); menu->addAction( computeFromLayer ); computeValuesButton->setMenu( menu ); connect( computeValuesButton, SIGNAL( clicked() ), computeValuesButton, SLOT( showMenu() ) ); //mExpressionWidget->setFilters( QgsFieldProxyModel::Numeric | QgsFieldProxyModel::Date ); if ( mLayer ) { mExpressionWidget->setLayer( mLayer ); } scaleMethodComboBox->addItem( tr( "Flannery" ), int( QgsScaleExpression::Flannery ) ); scaleMethodComboBox->addItem( tr( "Surface" ), int( QgsScaleExpression::Area ) ); scaleMethodComboBox->addItem( tr( "Radius" ), int( QgsScaleExpression::Linear ) ); minSizeSpinBox->setShowClearButton( false ); maxSizeSpinBox->setShowClearButton( false ); minValueSpinBox->setShowClearButton( false ); maxValueSpinBox->setShowClearButton( false ); nullSizeSpinBox->setShowClearButton( false ); // setup ui from expression if any setFromSymbol(); connect( minSizeSpinBox, SIGNAL( valueChanged( double ) ), this, SLOT( updatePreview() ) ); connect( maxSizeSpinBox, SIGNAL( valueChanged( double ) ), this, SLOT( updatePreview() ) ); connect( minValueSpinBox, SIGNAL( valueChanged( double ) ), this, SLOT( updatePreview() ) ); connect( maxValueSpinBox, SIGNAL( valueChanged( double ) ), this, SLOT( updatePreview() ) ); connect( nullSizeSpinBox, SIGNAL( valueChanged( double ) ), this, SLOT( updatePreview() ) ); //potentially very expensive for large layers: connect( mExpressionWidget, SIGNAL( fieldChanged( QString ) ), this, SLOT( computeFromLayerTriggered() ) ); connect( scaleMethodComboBox, SIGNAL( currentIndexChanged( int ) ), this, SLOT( updatePreview() ) ); }
void TypeEditDialog::onFieldChanged(types::tfield_id id, QString newText) { emit fieldChanged(id, newText); }
void QgsFieldExpressionWidget::expressionEdited( const QString& expression ) { updateLineEditStyle( expression ); emit fieldChanged( expression, isValidExpression() ); }
void StringWidget::on_EditValue_textChanged(const QString &arg1) { emit fieldChanged(m_Value); }
QgsHeatmapRendererWidget::QgsHeatmapRendererWidget( QgsVectorLayer* layer, QgsStyleV2* style, QgsFeatureRendererV2* renderer ) : QgsRendererV2Widget( layer, style ) , mRenderer( nullptr ) { if ( !layer ) { return; } // the renderer only applies to point vector layers if ( layer->geometryType() != QGis::Point ) { //setup blank dialog mRenderer = nullptr; QGridLayout* layout = new QGridLayout( this ); QLabel* label = new QLabel( tr( "The heatmap renderer only applies to point and multipoint layers. \n" "'%1' is not a point layer and cannot be rendered as a heatmap." ) .arg( layer->name() ), this ); layout->addWidget( label ); return; } setupUi( this ); mRadiusUnitWidget->setUnits( QgsSymbolV2::OutputUnitList() << QgsSymbolV2::MM << QgsSymbolV2::Pixel << QgsSymbolV2::MapUnit ); mWeightExpressionWidget->registerGetExpressionContextCallback( &_getExpressionContext, this ); if ( renderer ) { mRenderer = QgsHeatmapRenderer::convertFromRenderer( renderer ); } if ( !mRenderer ) { mRenderer = new QgsHeatmapRenderer(); } mRampComboBox->setShowGradientOnly( true ); mRampComboBox->populate( QgsStyleV2::defaultStyle() ); connect( mRampComboBox, SIGNAL( currentIndexChanged( int ) ), this, SLOT( applyColorRamp() ) ); connect( mRampComboBox, SIGNAL( sourceRampEdited() ), this, SLOT( applyColorRamp() ) ); connect( mButtonEditRamp, SIGNAL( clicked() ), mRampComboBox, SLOT( editSourceRamp() ) ); if ( mRenderer->colorRamp() ) { mRampComboBox->blockSignals( true ); mRampComboBox->setSourceColorRamp( mRenderer->colorRamp() ); mRampComboBox->blockSignals( false ); } mRadiusSpinBox->blockSignals( true ); mRadiusSpinBox->setValue( mRenderer->radius() ); mRadiusSpinBox->blockSignals( false ); mRadiusUnitWidget->blockSignals( true ); mRadiusUnitWidget->setUnit( mRenderer->radiusUnit() ); mRadiusUnitWidget->setMapUnitScale( mRenderer->radiusMapUnitScale() ); mRadiusUnitWidget->blockSignals( false ); mMaxSpinBox->blockSignals( true ); mMaxSpinBox->setValue( mRenderer->maximumValue() ); mMaxSpinBox->blockSignals( false ); mQualitySlider->blockSignals( true ); mQualitySlider->setValue( mRenderer->renderQuality() ); mQualitySlider->blockSignals( false ); mInvertCheckBox->blockSignals( true ); mInvertCheckBox->setChecked( mRenderer->invertRamp() ); mInvertCheckBox->blockSignals( false ); mWeightExpressionWidget->setLayer( layer ); mWeightExpressionWidget->setField( mRenderer->weightExpression() ); connect( mWeightExpressionWidget, SIGNAL( fieldChanged( QString ) ), this, SLOT( weightExpressionChanged( QString ) ) ); }
void QgsFieldComboBox::indexChanged( int i ) { Q_UNUSED( i ); QString name = currentField(); emit fieldChanged( name ); }
QgsGraduatedSymbolRendererV2Widget::QgsGraduatedSymbolRendererV2Widget( QgsVectorLayer* layer, QgsStyleV2* style, QgsFeatureRendererV2* renderer ) : QgsRendererV2Widget( layer, style ) , mRenderer( nullptr ) , mModel( nullptr ) { // try to recognize the previous renderer // (null renderer means "no previous renderer") if ( renderer ) { mRenderer = QgsGraduatedSymbolRendererV2::convertFromRenderer( renderer ); } if ( !mRenderer ) { mRenderer = new QgsGraduatedSymbolRendererV2( "", QgsRangeList() ); } // setup user interface setupUi( this ); mModel = new QgsGraduatedSymbolRendererV2Model( this ); mExpressionWidget->setFilters( QgsFieldProxyModel::Numeric | QgsFieldProxyModel::Date ); mExpressionWidget->setLayer( mLayer ); mSizeUnitWidget->setUnits( QgsUnitTypes::RenderUnitList() << QgsUnitTypes::RenderMillimeters << QgsUnitTypes::RenderMapUnits << QgsUnitTypes::RenderPixels ); cboGraduatedColorRamp->populate( mStyle ); spinPrecision->setMinimum( QgsRendererRangeV2LabelFormat::MinPrecision ); spinPrecision->setMaximum( QgsRendererRangeV2LabelFormat::MaxPrecision ); // set project default color ramp QString defaultColorRamp = QgsProject::instance()->readEntry( "DefaultStyles", "/ColorRamp", "" ); if ( defaultColorRamp != "" ) { int index = cboGraduatedColorRamp->findText( defaultColorRamp, Qt::MatchCaseSensitive ); if ( index >= 0 ) cboGraduatedColorRamp->setCurrentIndex( index ); } viewGraduated->setStyle( new QgsGraduatedSymbolRendererV2ViewStyle( viewGraduated->style() ) ); mGraduatedSymbol = QgsSymbolV2::defaultSymbol( mLayer->geometryType() ); methodComboBox->blockSignals( true ); methodComboBox->addItem( "Color" ); if ( mGraduatedSymbol->type() == QgsSymbolV2::Marker ) { methodComboBox->addItem( "Size" ); minSizeSpinBox->setValue( 1 ); maxSizeSpinBox->setValue( 8 ); } else if ( mGraduatedSymbol->type() == QgsSymbolV2::Line ) { methodComboBox->addItem( "Size" ); minSizeSpinBox->setValue( .1 ); maxSizeSpinBox->setValue( 2 ); } methodComboBox->blockSignals( false ); connect( mExpressionWidget, SIGNAL( fieldChanged( QString ) ), this, SLOT( graduatedColumnChanged( QString ) ) ); connect( viewGraduated, SIGNAL( doubleClicked( const QModelIndex & ) ), this, SLOT( rangesDoubleClicked( const QModelIndex & ) ) ); connect( viewGraduated, SIGNAL( clicked( const QModelIndex & ) ), this, SLOT( rangesClicked( const QModelIndex & ) ) ); connect( viewGraduated, SIGNAL( customContextMenuRequested( const QPoint& ) ), this, SLOT( contextMenuViewCategories( const QPoint& ) ) ); connect( btnGraduatedClassify, SIGNAL( clicked() ), this, SLOT( classifyGraduated() ) ); connect( btnChangeGraduatedSymbol, SIGNAL( clicked() ), this, SLOT( changeGraduatedSymbol() ) ); connect( btnGraduatedDelete, SIGNAL( clicked() ), this, SLOT( deleteClasses() ) ); connect( btnDeleteAllClasses, SIGNAL( clicked() ), this, SLOT( deleteAllClasses() ) ); connect( btnGraduatedAdd, SIGNAL( clicked() ), this, SLOT( addClass() ) ); connect( cbxLinkBoundaries, SIGNAL( toggled( bool ) ), this, SLOT( toggleBoundariesLink( bool ) ) ); connect( mSizeUnitWidget, SIGNAL( changed() ), this, SLOT( on_mSizeUnitWidget_changed() ) ); connectUpdateHandlers(); // initialize from previously set renderer updateUiFromRenderer(); // menus for data-defined rotation/size QMenu* advMenu = new QMenu; advMenu->addAction( tr( "Symbol levels..." ), this, SLOT( showSymbolLevels() ) ); btnAdvanced->setMenu( advMenu ); mHistogramWidget->setLayer( mLayer ); mHistogramWidget->setRenderer( mRenderer ); connect( mHistogramWidget, SIGNAL( rangesModified( bool ) ), this, SLOT( refreshRanges( bool ) ) ); connect( mExpressionWidget, SIGNAL( fieldChanged( QString ) ), mHistogramWidget, SLOT( setSourceFieldExp( QString ) ) ); mExpressionWidget->registerGetExpressionContextCallback( &_getExpressionContext, this ); }
QgsGraduatedSymbolRendererV2Widget::QgsGraduatedSymbolRendererV2Widget( QgsVectorLayer* layer, QgsStyleV2* style, QgsFeatureRendererV2* renderer ) : QgsRendererV2Widget( layer, style ) , mRenderer( 0 ) , mModel( 0 ) { // try to recognize the previous renderer // (null renderer means "no previous renderer") if ( !renderer || renderer->type() != "graduatedSymbol" ) { // we're not going to use it - so let's delete the renderer delete renderer; mRenderer = new QgsGraduatedSymbolRendererV2( "", QgsRangeList() ); } else { mRenderer = static_cast<QgsGraduatedSymbolRendererV2*>( renderer ); } // setup user interface setupUi( this ); mExpressionWidget->setFilters( QgsFieldProxyModel::Numeric | QgsFieldProxyModel::Date ); mExpressionWidget->setLayer( mLayer ); cboGraduatedColorRamp->populate( mStyle ); // set project default color ramp QString defaultColorRamp = QgsProject::instance()->readEntry( "DefaultStyles", "/ColorRamp", "" ); if ( defaultColorRamp != "" ) { int index = cboGraduatedColorRamp->findText( defaultColorRamp, Qt::MatchCaseSensitive ); if ( index >= 0 ) cboGraduatedColorRamp->setCurrentIndex( index ); } mModel = new QgsGraduatedSymbolRendererV2Model( this ); mModel->setRenderer( mRenderer ); viewGraduated->setModel( mModel ); viewGraduated->resizeColumnToContents( 0 ); viewGraduated->resizeColumnToContents( 1 ); viewGraduated->resizeColumnToContents( 2 ); viewGraduated->setStyle( new QgsGraduatedSymbolRendererV2ViewStyle( viewGraduated->style() ) ); mGraduatedSymbol = QgsSymbolV2::defaultSymbol( mLayer->geometryType() ); connect( mExpressionWidget, SIGNAL( fieldChanged( QString ) ), this, SLOT( graduatedColumnChanged( QString ) ) ); connect( viewGraduated, SIGNAL( doubleClicked( const QModelIndex & ) ), this, SLOT( rangesDoubleClicked( const QModelIndex & ) ) ); connect( viewGraduated, SIGNAL( clicked( const QModelIndex & ) ), this, SLOT( rangesClicked( const QModelIndex & ) ) ); connect( viewGraduated, SIGNAL( customContextMenuRequested( const QPoint& ) ), this, SLOT( contextMenuViewCategories( const QPoint& ) ) ); connect( mModel, SIGNAL( rowsMoved() ), this, SLOT( rowsMoved() ) ); connect( btnGraduatedClassify, SIGNAL( clicked() ), this, SLOT( classifyGraduated() ) ); connect( btnChangeGraduatedSymbol, SIGNAL( clicked() ), this, SLOT( changeGraduatedSymbol() ) ); connect( btnGraduatedDelete, SIGNAL( clicked() ), this, SLOT( deleteClasses() ) ); connect( btnDeleteAllClasses, SIGNAL( clicked() ), this, SLOT( deleteAllClasses() ) ); connect( btnGraduatedAdd, SIGNAL( clicked() ), this, SLOT( addClass() ) ); // initialize from previously set renderer updateUiFromRenderer(); connect( spinGraduatedClasses, SIGNAL( valueChanged( int ) ) , this, SLOT( classifyGraduated() ) ); connect( cboGraduatedMode, SIGNAL( currentIndexChanged( int ) ) , this, SLOT( classifyGraduated() ) ); connect( cboGraduatedColorRamp, SIGNAL( currentIndexChanged( int ) ) , this, SLOT( reapplyColorRamp() ) ); // menus for data-defined rotation/size QMenu* advMenu = new QMenu; advMenu->addAction( tr( "Symbol levels..." ), this, SLOT( showSymbolLevels() ) ); mDataDefinedMenus = new QgsRendererV2DataDefinedMenus( advMenu, mLayer, mRenderer->rotationField(), mRenderer->sizeScaleField(), mRenderer->scaleMethod() ); connect( mDataDefinedMenus, SIGNAL( rotationFieldChanged( QString ) ), this, SLOT( rotationFieldChanged( QString ) ) ); connect( mDataDefinedMenus, SIGNAL( sizeScaleFieldChanged( QString ) ), this, SLOT( sizeScaleFieldChanged( QString ) ) ); connect( mDataDefinedMenus, SIGNAL( scaleMethodChanged( QgsSymbolV2::ScaleMethod ) ), this, SLOT( scaleMethodChanged( QgsSymbolV2::ScaleMethod ) ) ); btnAdvanced->setMenu( advMenu ); }