void QgsLabelingWidget::labelModeChanged( int index ) { if ( index < 0 ) return; if ( index == 2 ) { if ( mWidget ) mStackedWidget->removeWidget( mWidget ); delete mWidget; mWidget = nullptr; QgsRuleBasedLabelingWidget* ruleWidget = new QgsRuleBasedLabelingWidget( mLayer, mCanvas, this, mDockMode ); connect( ruleWidget, SIGNAL( widgetChanged() ), this, SIGNAL( widgetChanged() ) ); mWidget = ruleWidget; mStackedWidget->addWidget( mWidget ); mStackedWidget->setCurrentWidget( mWidget ); } else { if ( index == 3 ) mLabelGui->setLabelMode( QgsLabelingGui::ObstaclesOnly ); else mLabelGui->setLabelMode( static_cast< QgsLabelingGui::LabelMode >( index ) ); mLabelGui->setLayer( mLayer ); mStackedWidget->setCurrentWidget( mLabelGui ); } emit widgetChanged(); }
QWidget * PatternWallpaper::createConfigurationInterface(QWidget * parent) { QWidget * configWidget = new QWidget(parent); m_ui.setupUi(configWidget); m_ui.m_fgColor->setColor(m_fgColor); m_ui.m_bgColor->setColor(m_bgColor); m_model = new BackgroundListModel(this, configWidget); m_model->setWallpaperSize(targetSizeHint().toSize()); m_model->reload(); QTimer::singleShot(0, this, SLOT(setConfigurationInterfaceModel())); m_ui.m_pattern->setItemDelegate(new BackgroundDelegate(m_ui.m_pattern)); m_ui.m_pattern->setMinimumWidth((BackgroundDelegate::SCREENSHOT_SIZE + BackgroundDelegate::MARGIN * 2 + BackgroundDelegate::BLUR_INCREMENT) * 3 + m_ui.m_pattern->spacing() * 4 + QApplication::style()->pixelMetric(QStyle::PM_ScrollBarExtent) + QApplication::style()->pixelMetric(QStyle::PM_DefaultFrameWidth) * 2 + 7); m_ui.m_pattern->setVerticalScrollMode(QAbstractItemView::ScrollPerPixel); connect(m_ui.m_fgColor, SIGNAL(changed(QColor)), SLOT(widgetChanged())); connect(m_ui.m_bgColor, SIGNAL(changed(QColor)), SLOT(widgetChanged())); connect(this, SIGNAL(settingsChanged(bool)), parent, SLOT(settingsChanged(bool))); return configWidget; }
void QgsLabelingWidget::labelModeChanged( int index ) { if ( index < 0 ) return; if ( index == 2 ) { if ( mWidget ) mStackedWidget->removeWidget( mWidget ); delete mWidget; mWidget = nullptr; QgsRuleBasedLabelingWidget* ruleWidget = new QgsRuleBasedLabelingWidget( mLayer, mCanvas, this ); ruleWidget->setDockMode( dockMode() ); connect( ruleWidget, SIGNAL( showPanel( QgsPanelWidget* ) ), this, SLOT( openPanel( QgsPanelWidget* ) ) ); connect( ruleWidget, SIGNAL( widgetChanged() ), this, SIGNAL( widgetChanged() ) ); mWidget = ruleWidget; mStackedWidget->addWidget( mWidget ); mStackedWidget->setCurrentWidget( mWidget ); } else { if ( index == 3 )
QgsSingleBandGrayRendererWidget::QgsSingleBandGrayRendererWidget( QgsRasterLayer* layer, const QgsRectangle &extent ) : QgsRasterRendererWidget( layer, extent ) , mMinMaxWidget( nullptr ) { setupUi( this ); mGradientComboBox->insertItem( 0, tr( "Black to white" ), QgsSingleBandGrayRenderer::BlackToWhite ); mGradientComboBox->insertItem( 1, tr( "White to black" ), QgsSingleBandGrayRenderer::WhiteToBlack ); mMinLineEdit->setValidator( new QDoubleValidator( mMinLineEdit ) ); mMaxLineEdit->setValidator( new QDoubleValidator( mMaxLineEdit ) ); if ( mRasterLayer ) { QgsRasterDataProvider* provider = mRasterLayer->dataProvider(); if ( !provider ) { return; } mMinMaxWidget = new QgsRasterMinMaxWidget( layer, this ); mMinMaxWidget->setExtent( extent ); mMinMaxWidget->setMapCanvas( mCanvas ); QHBoxLayout *layout = new QHBoxLayout(); layout->setContentsMargins( 0, 0, 0, 0 ); mMinMaxContainerWidget->setLayout( layout ); layout->addWidget( mMinMaxWidget ); connect( mMinMaxWidget, SIGNAL( load( int, double, double, int ) ), this, SLOT( loadMinMax( int, double, double, int ) ) ); //fill available bands into combo box int nBands = provider->bandCount(); for ( int i = 1; i <= nBands; ++i ) //band numbering seem to start at 1 { mGrayBandComboBox->addItem( displayBandName( i ), i ); } //contrast enhancement algorithms mContrastEnhancementComboBox->addItem( tr( "No enhancement" ), 0 ); mContrastEnhancementComboBox->addItem( tr( "Stretch to MinMax" ), 1 ); mContrastEnhancementComboBox->addItem( tr( "Stretch and clip to MinMax" ), 2 ); mContrastEnhancementComboBox->addItem( tr( "Clip to MinMax" ), 3 ); setFromRenderer( layer->renderer() ); connect( mGradientComboBox, SIGNAL( currentIndexChanged( int ) ), this, SIGNAL( widgetChanged() ) ); connect( mContrastEnhancementComboBox, SIGNAL( currentIndexChanged( int ) ), this, SIGNAL( widgetChanged() ) ); connect( mMaxLineEdit, SIGNAL( textChanged( QString ) ), this, SIGNAL( widgetChanged() ) ); connect( mMinLineEdit, SIGNAL( textChanged( QString ) ), this, SIGNAL( widgetChanged() ) ); } }
void ComboWidget::setWidget( QString name) { if (m_widgets.contains(name)) { m_layout->removeWidget(m_currentWidget); m_currentWidget->hide(); m_currentWidget = m_widgets[name]; m_layout->addWidget(m_currentWidget); m_currentWidget->show(); widgetChanged(m_widgets[name]); widgetChanged(name); } }
void QgsRuleBasedRendererV2Widget::addRule() { QgsSymbolV2* s = QgsSymbolV2::defaultSymbol( mLayer->geometryType() ); QgsRuleBasedRendererV2::Rule* newrule = new QgsRuleBasedRendererV2::Rule( s ); QgsRendererRulePropsDialog dlg( newrule, mLayer, mStyle, this, mMapCanvas ); if ( dlg.exec() ) { QgsRuleBasedRendererV2::Rule* current = currentRule(); if ( current ) { // add after this rule QModelIndex currentIndex = viewRules->selectionModel()->currentIndex(); mModel->insertRule( currentIndex.parent(), currentIndex.row() + 1, newrule ); } else { // append to root rule int rows = mModel->rowCount(); mModel->insertRule( QModelIndex(), rows, newrule ); } mModel->clearFeatureCounts(); emit widgetChanged(); } else { delete newrule; } }
void QgsVectorLayer3DRendererWidget::onEnabledClicked() { widgetLine->setEnabled( chkEnabled->isChecked() ); widgetPoint->setEnabled( chkEnabled->isChecked() ); widgetPolygon->setEnabled( chkEnabled->isChecked() ); emit widgetChanged(); }
void QgsSingleBandGrayRendererWidget::on_mGrayBandComboBox_currentIndexChanged( int index ) { QList<int> myBands; myBands.append( mGrayBandComboBox->itemData( index ).toInt() ); mMinMaxWidget->setBands( myBands ); emit widgetChanged(); }
KConfigDialogManager *KCModule::addConfig(KConfigSkeleton *config, QWidget *widget) { KConfigDialogManager *manager = new KConfigDialogManager(widget, config, name()); connect(manager, SIGNAL(widgetModified()), SLOT(widgetChanged())); d->managers.append(manager); return manager; }
void QgsPalettedRendererWidget::bandChanged( int band ) { if ( band == mBand ) return; bool deleteExisting = false; if ( !mModel->classData().isEmpty() ) { int res = QMessageBox::question( this, tr( "Delete Classification" ), tr( "The classification band was changed from %1 to %2.\n" "Should the existing classes be deleted?" ).arg( mBand ).arg( band ), QMessageBox::Yes | QMessageBox::No ); deleteExisting = ( res == QMessageBox::Yes ); } mBand = band; mModel->blockSignals( true ); if ( deleteExisting ) mModel->deleteAll(); mModel->blockSignals( false ); emit widgetChanged(); }
void QgsPalettedRendererWidget::changeLabel() { QItemSelection sel = mTreeView->selectionModel()->selection(); QModelIndex labelIndex = mModel->index( sel.first().top(), QgsPalettedRendererModel::LabelColumn ); QString currentLabel = mModel->data( labelIndex, Qt::DisplayRole ).toString(); bool ok; QString newLabel = QInputDialog::getText( this, tr( "Label" ), tr( "Change label" ), QLineEdit::Normal, currentLabel, &ok ); if ( ok ) { // don't want to emit widgetChanged multiple times disconnect( mModel, &QgsPalettedRendererModel::classesChanged, this, &QgsPalettedRendererWidget::widgetChanged ); const auto constSel = sel; for ( const QItemSelectionRange &range : constSel ) { const auto constIndexes = range.indexes(); for ( const QModelIndex &index : constIndexes ) { labelIndex = mModel->index( index.row(), QgsPalettedRendererModel::LabelColumn ); mModel->setData( labelIndex, newLabel, Qt::EditRole ); } } connect( mModel, &QgsPalettedRendererModel::classesChanged, this, &QgsPalettedRendererWidget::widgetChanged ); emit widgetChanged(); } }
void QgsPalettedRendererWidget::changeOpacity() { QItemSelection sel = mTreeView->selectionModel()->selection(); QModelIndex colorIndex = mModel->index( sel.first().top(), QgsPalettedRendererModel::ColorColumn ); QColor currentColor = mModel->data( colorIndex, Qt::DisplayRole ).value<QColor>(); bool ok; double oldOpacity = ( currentColor.alpha() / 255.0 ) * 100.0; double opacity = QInputDialog::getDouble( this, tr( "Opacity" ), tr( "Change color opacity [%]" ), oldOpacity, 0.0, 100.0, 0, &ok ); if ( ok ) { int newOpacity = opacity / 100 * 255; // don't want to emit widgetChanged multiple times disconnect( mModel, &QgsPalettedRendererModel::classesChanged, this, &QgsPalettedRendererWidget::widgetChanged ); const auto constSel = sel; for ( const QItemSelectionRange &range : constSel ) { const auto constIndexes = range.indexes(); for ( const QModelIndex &index : constIndexes ) { colorIndex = mModel->index( index.row(), QgsPalettedRendererModel::ColorColumn ); QColor newColor = mModel->data( colorIndex, Qt::DisplayRole ).value<QColor>(); newColor.setAlpha( newOpacity ); mModel->setData( colorIndex, newColor, Qt::EditRole ); } } connect( mModel, &QgsPalettedRendererModel::classesChanged, this, &QgsPalettedRendererWidget::widgetChanged ); emit widgetChanged(); } }
void QgsDataDefinedSizeLegendWidget::changeSymbol() { std::unique_ptr<QgsMarkerSymbol> newSymbol( mSourceSymbol->clone() ); QgsSymbolWidgetContext context; if ( mMapCanvas ) context.setMapCanvas( mMapCanvas ); QgsExpressionContext ec; ec << QgsExpressionContextUtils::globalScope() << QgsExpressionContextUtils::projectScope( QgsProject::instance() ) << QgsExpressionContextUtils::atlasScope( nullptr ); if ( mMapCanvas ) ec << QgsExpressionContextUtils::mapSettingsScope( mMapCanvas->mapSettings() ); context.setExpressionContext( &ec ); QString crsAuthId = mMapCanvas ? mMapCanvas->mapSettings().destinationCrs().authid() : QString(); std::unique_ptr<QgsVectorLayer> layer( new QgsVectorLayer( "Point?crs=" + crsAuthId, "tmp", "memory" ) ); QgsSymbolSelectorDialog d( newSymbol.get(), QgsStyle::defaultStyle(), layer.get(), this ); d.setContext( context ); if ( d.exec() != QDialog::Accepted ) return; mSourceSymbol.reset( newSymbol.release() ); QIcon icon = QgsSymbolLayerUtils::symbolPreviewIcon( mSourceSymbol.get(), btnChangeSymbol->iconSize() ); btnChangeSymbol->setIcon( icon ); emit widgetChanged(); }
void QuteWidget::applyProperties() { // qDebug() << "QuteWidget::applyProperties()"; #ifdef USE_WIDGET_MUTEX widgetLock.lockForRead(); #endif setProperty("QCS_objectName", nameLineEdit->text()); setProperty("QCS_x", xSpinBox->value()); setProperty("QCS_y",ySpinBox->value()); setProperty("QCS_width", wSpinBox->value()); setProperty("QCS_height", hSpinBox->value()); if (acceptsMidi()) { setProperty("QCS_midicc", midiccSpinBox->value()); setProperty("QCS_midichan", midichanSpinBox->value()); } #ifdef USE_WIDGET_MUTEX widgetLock.unlock(); #endif applyInternalProperties(); // setChannelName(nameLineEdit->text()); // setWidgetGeometry(xSpinBox->value(), ySpinBox->value(), wSpinBox->value(), hSpinBox->value()); // this->setMouseTracking(true); // Necessary to pass mouse tracking to widget panel for _MouseX channels emit(widgetChanged(this)); emit propertiesAccepted(); parentWidget()->setFocus(Qt::PopupFocusReason); // For some reason focus is grabbed away from the layout m_valueChanged = true; }
bool DMainWindow::eventFilter(QObject *obj, QEvent *ev) { QWidget *w = (QWidget*)obj; if (!m_widgets.contains(w)) return KParts::MainWindow::eventFilter(obj, ev); if ((m_currentWidget != w) && (ev->type() == QEvent::FocusIn)) { m_currentWidget = w; emit widgetChanged(w); } else if (ev->type() == QEvent::IconChange) { if (m_widgetTabs.contains(w)) { DTabWidget *tab = m_widgetTabs[w]; tab->setTabIconSet(w, w->icon() ? (*(w->icon())) : QPixmap()); } } else if (ev->type() == QEvent::CaptionChange) { kdDebug() << "caption change" << endl; } return KParts::MainWindow::eventFilter(obj, ev); }
void QgsRuleBasedRendererWidget::editRule( const QModelIndex &index ) { if ( !index.isValid() ) return; QgsRuleBasedRenderer::Rule *rule = mModel->ruleForIndex( index ); QgsPanelWidget *panel = QgsPanelWidget::findParentPanel( this ); if ( panel && panel->dockMode() ) { QgsRendererRulePropsWidget *widget = new QgsRendererRulePropsWidget( rule, mLayer, mStyle, this, mContext );//panel? widget->setPanelTitle( tr( "Edit Rule" ) ); connect( widget, &QgsPanelWidget::panelAccepted, this, &QgsRuleBasedRendererWidget::ruleWidgetPanelAccepted ); connect( widget, &QgsPanelWidget::widgetChanged, this, &QgsRuleBasedRendererWidget::liveUpdateRuleFromPanel ); openPanel( widget ); return; } QgsRendererRulePropsDialog dlg( rule, mLayer, mStyle, this, mContext ); if ( dlg.exec() ) { mModel->updateRule( index.parent(), index.row() ); mModel->clearFeatureCounts(); emit widgetChanged(); } }
void QgsMeshRendererActiveDatasetWidget::onActiveDatasetChanged( int value ) { int groupIndex = mDatasetGroupTreeView->activeGroup(); mActiveScalarDataset = QgsMeshDatasetIndex(); mActiveVectorDataset = QgsMeshDatasetIndex(); QgsMeshDatasetIndex datasetIndex( groupIndex, value ); if ( mMeshLayer && mMeshLayer->dataProvider() && datasetIndex.isValid() && mMeshLayer->dataProvider()->datasetCount( groupIndex ) > value ) { const QgsMeshDatasetGroupMetadata meta = mMeshLayer->dataProvider()->datasetGroupMetadata( datasetIndex ); mActiveScalarDataset = datasetIndex; if ( meta.isVector() ) mActiveVectorDataset = datasetIndex; } updateMetadata( datasetIndex ); emit activeScalarDatasetChanged( activeScalarDataset() ); emit activeVectorDatasetChanged( activeVectorDataset() ); emit widgetChanged(); }
void QgsPointDisplacementRendererWidget::on_mRendererSettingsButton_clicked() { if ( !mRenderer ) return; QgsRendererAbstractMetadata* m = QgsRendererRegistry::instance()->rendererMetadata( mRenderer->embeddedRenderer()->type() ); if ( m ) { QgsRendererWidget* w = m->createRendererWidget( mLayer, mStyle, mRenderer->embeddedRenderer()->clone() ); w->setPanelTitle( tr( "Renderer settings" ) ); QgsSymbolWidgetContext context = mContext; QgsExpressionContextScope scope; scope.addVariable( QgsExpressionContextScope::StaticVariable( QgsExpressionContext::EXPR_CLUSTER_COLOR, "", true ) ); scope.addVariable( QgsExpressionContextScope::StaticVariable( QgsExpressionContext::EXPR_CLUSTER_SIZE, 0, true ) ); QList< QgsExpressionContextScope > scopes = context.additionalExpressionContextScopes(); scopes << scope; context.setAdditionalExpressionContextScopes( scopes ); w->setContext( context ); connect( w, SIGNAL( widgetChanged() ), this, SLOT( updateRendererFromWidget() ) ); openPanel( w ); } }
void QgsEffectStackPropertiesWidget::updatePreview() { QPainter painter; QImage previewImage( 150, 150, QImage::Format_ARGB32 ); previewImage.fill( Qt::transparent ); painter.begin( &previewImage ); painter.setRenderHint( QPainter::Antialiasing ); QgsRenderContext context = QgsSymbolLayerUtils::createRenderContext( &painter ); if ( !mPreviewPicture ) { QPicture previewPic; QPainter previewPicPainter; previewPicPainter.begin( &previewPic ); previewPicPainter.setPen( Qt::red ); previewPicPainter.setBrush( QColor( 255, 100, 100, 255 ) ); previewPicPainter.drawEllipse( QPoint( 75, 75 ), 30, 30 ); previewPicPainter.end(); mStack->render( previewPic, context ); } else { context.painter()->translate( 35, 35 ); mStack->render( *mPreviewPicture, context ); } painter.end(); lblPreview->setPixmap( QPixmap::fromImage( previewImage ) ); emit widgetChanged(); }
void QgsGraduatedSymbolRendererWidget::applyChangeToSymbol() { mSizeUnitWidget->blockSignals( true ); mSizeUnitWidget->setUnit( mGraduatedSymbol->outputUnit() ); mSizeUnitWidget->setMapUnitScale( mGraduatedSymbol->mapUnitScale() ); mSizeUnitWidget->blockSignals( false ); QItemSelectionModel *m = viewGraduated->selectionModel(); QModelIndexList selectedIndexes = m->selectedRows( 1 ); if ( m && !selectedIndexes.isEmpty() ) { const auto constSelectedIndexes = selectedIndexes; for ( const QModelIndex &idx : constSelectedIndexes ) { if ( idx.isValid() ) { int rangeIdx = idx.row(); QgsSymbol *newRangeSymbol = mGraduatedSymbol->clone(); if ( selectedIndexes.count() > 1 ) { //if updating multiple ranges, retain the existing range colors newRangeSymbol->setColor( mRenderer->ranges().at( rangeIdx ).symbol()->color() ); } mRenderer->updateRangeSymbol( rangeIdx, newRangeSymbol ); } } } else { mRenderer->updateSymbols( mGraduatedSymbol.get() ); } refreshSymbolView(); emit widgetChanged(); }
void QgsSingleBandPseudoColorRendererWidget::on_mColorInterpolationComboBox_currentIndexChanged( int index ) { QgsColorRampShader::ColorRamp_TYPE interpolation = static_cast< QgsColorRampShader::ColorRamp_TYPE >( mColorInterpolationComboBox->itemData( index ).toInt() ); mClipCheckBox->setEnabled( interpolation == QgsColorRampShader::INTERPOLATED ); QString valueLabel; QString valueToolTip; switch ( interpolation ) { case QgsColorRampShader::INTERPOLATED: valueLabel = tr( "Value" ); valueToolTip = tr( "Value for color stop" ); break; case QgsColorRampShader::DISCRETE: valueLabel = tr( "Value <=" ); valueToolTip = tr( "Maximum value for class" ); break; case QgsColorRampShader::EXACT: valueLabel = tr( "Value =" ); valueToolTip = tr( "Value for color" ); break; } QTreeWidgetItem* header = mColormapTreeWidget->headerItem(); header->setText( ValueColumn, valueLabel ); header->setToolTip( ValueColumn, valueToolTip ); autoLabel(); emit widgetChanged(); }
void QgsSingleBandPseudoColorRendererWidget::on_mColormapTreeWidget_itemDoubleClicked( QTreeWidgetItem* item, int column ) { if ( !item ) { return; } if ( column == ColorColumn ) { item->setFlags( Qt::ItemIsEnabled | Qt::ItemIsSelectable ); QColor newColor = QgsColorDialog::getColor( item->background( column ).color(), this, "Change color", true ); if ( newColor.isValid() ) { item->setBackground( ColorColumn, QBrush( newColor ) ); emit widgetChanged(); } } else { if ( column == LabelColumn ) { // Set text color to default black, which signifies a manually edited label item->setForeground( LabelColumn, QBrush() ); } item->setFlags( Qt::ItemIsEnabled | Qt::ItemIsEditable | Qt::ItemIsSelectable ); } }
void QgsSingleBandGrayRendererWidget::bandChanged() { QList<int> myBands; myBands.append( mGrayBandComboBox->currentBand() ); mMinMaxWidget->setBands( myBands ); emit widgetChanged(); }
void QgsRendererRasterPropertiesWidget::toggleColorizeControls( bool colorizeEnabled ) { // Enable or disable colorize controls based on checkbox btnColorizeColor->setEnabled( colorizeEnabled ); sliderColorizeStrength->setEnabled( colorizeEnabled ); spinColorizeStrength->setEnabled( colorizeEnabled ); emit widgetChanged(); }
void QgsPointDisplacementRendererWidget::on_mPlacementComboBox_currentIndexChanged( int index ) { if ( !mRenderer ) return; mRenderer->setPlacement(( QgsPointDisplacementRenderer::Placement )mPlacementComboBox->itemData( index ).toInt() ); emit widgetChanged(); }
void QgsPointDisplacementRendererWidget::on_mCircleWidthSpinBox_valueChanged( double d ) { if ( mRenderer ) { mRenderer->setCircleWidth( d ); emit widgetChanged(); } }
void QgsGraduatedSymbolRendererV2Widget::refreshRanges( bool reset ) { if ( !mModel ) return; mModel->updateSymbology( reset ); emit widgetChanged(); }
void QThemeWidget::colorChanged() { QColor color = QColorDialog::getColor(); if (!color.isValid()) return; setThemeColor(color); emit widgetChanged(); }
void QgsPointDisplacementRendererWidget::updateCenterSymbolFromWidget() { QgsSymbolSelectorWidget* dlg = qobject_cast<QgsSymbolSelectorWidget*>( sender() ); QgsSymbol* symbol = dlg->symbol()->clone(); mRenderer->setCenterSymbol( static_cast< QgsMarkerSymbol* >( symbol ) ); updateCenterIcon(); emit widgetChanged(); }
void QgsPointDisplacementRendererWidget::on_mDistanceSpinBox_valueChanged( double d ) { if ( mRenderer ) { mRenderer->setTolerance( d ); emit widgetChanged(); } }