Exemplo n.º 1
0
QgsRelationManager::QgsRelationManager( QgsProject* project )
    : QObject( project )
    , mProject( project )
{
  connect( project, SIGNAL( readProject( const QDomDocument& ) ), SLOT( readProject( const QDomDocument& ) ) );
  connect( project, SIGNAL( writeProject( QDomDocument& ) ), SLOT( writeProject( QDomDocument& ) ) );
  connect( project, SIGNAL( layersRemoved( QStringList ) ), this, SLOT( layersRemoved( QStringList ) ) );
}
Exemplo n.º 2
0
QgsVisibilityPresets::QgsVisibilityPresets()
    : mMenu( new QMenu )
{

  mMenu->addAction( QgisApp::instance()->actionShowAllLayers() );
  mMenu->addAction( QgisApp::instance()->actionHideAllLayers() );
  mMenu->addAction( QgisApp::instance()->actionShowSelectedLayers() );
  mMenu->addAction( QgisApp::instance()->actionHideSelectedLayers() );
  mMenu->addSeparator();

  mMenu->addAction( tr( "Add Preset..." ), this, SLOT( addPreset() ) );
  mMenuSeparator = mMenu->addSeparator();

  mActionRemoveCurrentPreset = mMenu->addAction( tr( "Remove Current Preset" ), this, SLOT( removeCurrentPreset() ) );

  connect( mMenu, SIGNAL( aboutToShow() ), this, SLOT( menuAboutToShow() ) );

  connect( QgsMapLayerRegistry::instance(), SIGNAL( layersRemoved( QStringList ) ),
           this, SLOT( registryLayersRemoved( QStringList ) ) );

  connect( QgsProject::instance(), SIGNAL( readProject( const QDomDocument & ) ),
           this, SLOT( readProject( const QDomDocument & ) ) );
  connect( QgsProject::instance(), SIGNAL( writeProject( QDomDocument & ) ),
           this, SLOT( writeProject( QDomDocument & ) ) );
}
QgsBullsEyeWidget::QgsBullsEyeWidget( QgsMapCanvas *canvas, QgsLayerTreeView* layerTreeView )
    : QgsBottomBar( canvas ), mLayerTreeView( layerTreeView )
{
  setLayout( new QHBoxLayout );
  layout()->setSpacing( 10 );

  QWidget* base = new QWidget();
  ui.setupUi( base );
  layout()->addWidget( base );

  QPushButton* closeButton = new QPushButton();
  closeButton->setSizePolicy( QSizePolicy::Preferred, QSizePolicy::Preferred );
  closeButton->setIcon( QIcon( ":/images/themes/default/mIconClose.png" ) );
  closeButton->setToolTip( tr( "Close" ) );
  connect( closeButton, SIGNAL( clicked( bool ) ), this, SIGNAL( close() ) );
  layout()->addWidget( closeButton );
  layout()->setAlignment( closeButton, Qt::AlignTop );

  ui.comboBoxLabels->addItem( tr( "Disabled" ), static_cast<int>( QgsBullsEyeLayer::NO_LABELS ) );
  ui.comboBoxLabels->addItem( tr( "Axes" ), static_cast<int>( QgsBullsEyeLayer::LABEL_AXES ) );
  ui.comboBoxLabels->addItem( tr( "Rings" ), static_cast<int>( QgsBullsEyeLayer::LABEL_RINGS ) );
  ui.comboBoxLabels->addItem( tr( "Axes and rings" ), static_cast<int>( QgsBullsEyeLayer::LABEL_AXES_RINGS ) );

  connect( ui.toolButtonAddLayer, SIGNAL( clicked( bool ) ), this, SLOT( createLayer() ) );
  connect( ui.inputCenter, SIGNAL( coordinateChanged() ), this, SLOT( updateLayer() ) );
  connect( ui.toolButtonPickCenter, SIGNAL( clicked( bool ) ), this, SIGNAL( requestPickCenter() ) );
  connect( ui.spinBoxRings, SIGNAL( valueChanged( int ) ), this, SLOT( updateLayer() ) );

  connect( ui.spinBoxRingInterval, SIGNAL( valueChanged( double ) ), this, SLOT( updateLayer() ) );
  connect( ui.spinBoxAxesInterval, SIGNAL( valueChanged( double ) ), this, SLOT( updateLayer() ) );

  connect( ui.toolButtonColor, SIGNAL( colorChanged( QColor ) ), this, SLOT( updateColor( QColor ) ) );
  connect( ui.spinBoxFontSize, SIGNAL( valueChanged( int ) ), this, SLOT( updateFontSize( int ) ) );
  connect( ui.comboBoxLabels, SIGNAL( currentIndexChanged( int ) ), this, SLOT( updateLabeling( int ) ) );
  connect( ui.spinBoxLineWidth, SIGNAL( valueChanged( int ) ), this, SLOT( updateLineWidth( int ) ) );

  connect( QgsMapLayerRegistry::instance(), SIGNAL( layersAdded( QList<QgsMapLayer*> ) ), this, SLOT( repopulateLayers() ) );
  connect( QgsMapLayerRegistry::instance(), SIGNAL( layersRemoved( QStringList ) ), this, SLOT( repopulateLayers() ) );
  connect( mCanvas, SIGNAL( currentLayerChanged( QgsMapLayer* ) ), this, SLOT( updateSelectedLayer( QgsMapLayer* ) ) );

  repopulateLayers();
  connect( ui.comboBoxLayer, SIGNAL( currentIndexChanged( int ) ), this, SLOT( currentLayerChanged( int ) ) );
}
Exemplo n.º 4
0
QgsMapThemeCollection::QgsMapThemeCollection()
{
  connect( QgsMapLayerRegistry::instance(), SIGNAL( layersRemoved( QStringList ) ),
           this, SLOT( registryLayersRemoved( QStringList ) ) );
}
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 );
  }