Example #1
0
void QgsColorDialogV2::schemeIndexChanged( int index )
{
  //save changes to scheme
  if ( mSchemeList->isDirty() )
  {
    mSchemeList->saveColorsToScheme();
  }

  //get schemes with ShowInColorDialog set
  QList<QgsColorScheme *> schemeList = QgsColorSchemeRegistry::instance()->schemes( QgsColorScheme::ShowInColorDialog );
  if ( index >= schemeList.length() )
  {
    return;
  }

  QgsColorScheme* scheme = schemeList.at( index );
  mSchemeList->setScheme( scheme );
  mActionImportColors->setEnabled( scheme->isEditable() );
  mActionPasteColors->setEnabled( scheme->isEditable() );
  mAddColorToSchemeButton->setEnabled( scheme->isEditable() );
  mRemoveColorsFromSchemeButton->setEnabled( scheme->isEditable() );
  QgsUserColorScheme* userScheme = dynamic_cast<QgsUserColorScheme*>( scheme );
  mActionRemovePalette->setEnabled( userScheme ? true : false );

  //copy action defaults to disabled
  mActionCopyColors->setEnabled( false );
}
Example #2
0
void QgsColorDialogV2::schemeIndexChanged( int index )
{
  //save changes to scheme
  if ( mSchemeList->isDirty() )
  {
    mSchemeList->saveColorsToScheme();
  }

  QList<QgsColorScheme *> schemeList = QgsColorSchemeRegistry::instance()->schemes();
  if ( index >= schemeList.length() )
  {
    return;
  }

  QgsColorScheme* scheme = schemeList.at( index );
  mSchemeList->setScheme( scheme );
  mActionImportColors->setEnabled( scheme->isEditable() );
  mActionPasteColors->setEnabled( scheme->isEditable() );
  mAddColorToSchemeButton->setEnabled( scheme->isEditable() );
  mRemoveColorsFromSchemeButton->setEnabled( scheme->isEditable() );
}
Example #3
0
void QgsCompoundColorWidget::updateActionsForCurrentScheme()
{
  QgsColorScheme *scheme = mSchemeList->scheme();

  mActionImportColors->setEnabled( scheme->isEditable() );
  mActionPasteColors->setEnabled( scheme->isEditable() );
  mAddColorToSchemeButton->setEnabled( scheme->isEditable() );
  mRemoveColorsFromSchemeButton->setEnabled( scheme->isEditable() );

  QgsUserColorScheme *userScheme = dynamic_cast<QgsUserColorScheme *>( scheme );
  mActionRemovePalette->setEnabled( userScheme ? true : false );
  if ( userScheme )
  {
    mActionShowInButtons->setEnabled( true );
    whileBlocking( mActionShowInButtons )->setChecked( userScheme->flags() & QgsColorScheme::ShowInColorButtonMenu );
  }
  else
  {
    whileBlocking( mActionShowInButtons )->setChecked( false );
    mActionShowInButtons->setEnabled( false );
  }
}