mirror of
https://github.com/qgis/QGIS.git
synced 2025-11-27 00:07:16 -05:00
[neeeds-docs] Show all color schemes and tools for interacting with the in the
options->color tab This brings all of QGIS' color scheme handling to a more logical and user-discoverable place. Previously this functionality was only available inside the color dialog itself (i.e. users would have to start changing a color before they could create and edit schemes)
This commit is contained in:
parent
2a0f36499a
commit
14c8b3c75d
@ -65,6 +65,45 @@ be stored in the recent color list.
|
|||||||
:param discarded: set to true to avoid adding color to recent color list on widget destruction.
|
:param discarded: set to true to avoid adding color to recent color list on widget destruction.
|
||||||
|
|
||||||
.. versionadded:: 3.0
|
.. versionadded:: 3.0
|
||||||
|
%End
|
||||||
|
|
||||||
|
static QgsUserColorScheme *importUserPaletteFromFile( QWidget *parent );
|
||||||
|
%Docstring
|
||||||
|
Triggers a user prompt for importing a new color scheme from an existing GPL file.
|
||||||
|
|
||||||
|
The ``parent`` argument must be set to a valid parent widget for the dialog prompts.
|
||||||
|
|
||||||
|
.. versionadded:: 3.2
|
||||||
|
|
||||||
|
.. seealso:: :py:func:`createNewUserPalette`
|
||||||
|
|
||||||
|
.. seealso:: :py:func:`removeUserPalette`
|
||||||
|
%End
|
||||||
|
|
||||||
|
static QgsUserColorScheme *createNewUserPalette( QWidget *parent );
|
||||||
|
%Docstring
|
||||||
|
Triggers a user prompt for creating a new user color scheme.
|
||||||
|
|
||||||
|
The ``parent`` argument must be set to a valid parent widget for the dialog prompts.
|
||||||
|
|
||||||
|
.. versionadded:: 3.2
|
||||||
|
|
||||||
|
.. seealso:: :py:func:`importUserPaletteFromFile`
|
||||||
|
|
||||||
|
.. seealso:: :py:func:`removeUserPalette`
|
||||||
|
%End
|
||||||
|
|
||||||
|
static bool removeUserPalette( QgsUserColorScheme *scheme, QWidget *parent );
|
||||||
|
%Docstring
|
||||||
|
Triggers a user prompt for removing an existing user color ``scheme``.
|
||||||
|
|
||||||
|
The ``parent`` argument must be set to a valid parent widget for the dialog prompts.
|
||||||
|
|
||||||
|
.. versionadded:: 3.2
|
||||||
|
|
||||||
|
.. seealso:: :py:func:`importUserPaletteFromFile`
|
||||||
|
|
||||||
|
.. seealso:: :py:func:`createNewUserPalette`
|
||||||
%End
|
%End
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
|
|||||||
@ -754,6 +754,66 @@ QgsOptions::QgsOptions( QWidget *parent, Qt::WindowFlags fl, const QList<QgsOpti
|
|||||||
connect( mButtonImportColors, &QAbstractButton::clicked, mTreeCustomColors, &QgsColorSchemeList::showImportColorsDialog );
|
connect( mButtonImportColors, &QAbstractButton::clicked, mTreeCustomColors, &QgsColorSchemeList::showImportColorsDialog );
|
||||||
connect( mButtonExportColors, &QAbstractButton::clicked, mTreeCustomColors, &QgsColorSchemeList::showExportColorsDialog );
|
connect( mButtonExportColors, &QAbstractButton::clicked, mTreeCustomColors, &QgsColorSchemeList::showExportColorsDialog );
|
||||||
|
|
||||||
|
connect( mActionImportPalette, &QAction::triggered, this, [ = ]
|
||||||
|
{
|
||||||
|
if ( QgsCompoundColorWidget::importUserPaletteFromFile( this ) )
|
||||||
|
{
|
||||||
|
//refresh combobox
|
||||||
|
refreshSchemeComboBox();
|
||||||
|
mColorSchemesComboBox->setCurrentIndex( mColorSchemesComboBox->count() - 1 );
|
||||||
|
}
|
||||||
|
} );
|
||||||
|
connect( mActionRemovePalette, &QAction::triggered, this, [ = ]
|
||||||
|
{
|
||||||
|
//get current scheme
|
||||||
|
QList<QgsColorScheme *> schemeList = QgsApplication::colorSchemeRegistry()->schemes();
|
||||||
|
int prevIndex = mColorSchemesComboBox->currentIndex();
|
||||||
|
if ( prevIndex >= schemeList.length() )
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
//make user scheme is a user removable scheme
|
||||||
|
QgsUserColorScheme *userScheme = dynamic_cast<QgsUserColorScheme *>( schemeList.at( prevIndex ) );
|
||||||
|
if ( !userScheme )
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( QgsCompoundColorWidget::removeUserPalette( userScheme, this ) )
|
||||||
|
{
|
||||||
|
refreshSchemeComboBox();
|
||||||
|
prevIndex = std::max( std::min( prevIndex, mColorSchemesComboBox->count() - 1 ), 0 );
|
||||||
|
mColorSchemesComboBox->setCurrentIndex( prevIndex );
|
||||||
|
}
|
||||||
|
} );
|
||||||
|
connect( mActionNewPalette, &QAction::triggered, this, [ = ]
|
||||||
|
{
|
||||||
|
if ( QgsCompoundColorWidget::createNewUserPalette( this ) )
|
||||||
|
{
|
||||||
|
//refresh combobox
|
||||||
|
refreshSchemeComboBox();
|
||||||
|
mColorSchemesComboBox->setCurrentIndex( mColorSchemesComboBox->count() - 1 );
|
||||||
|
}
|
||||||
|
} );
|
||||||
|
|
||||||
|
connect( mActionShowInButtons, &QAction::toggled, this, [ = ]( bool state )
|
||||||
|
{
|
||||||
|
QgsUserColorScheme *scheme = dynamic_cast< QgsUserColorScheme * >( mTreeCustomColors->scheme() );
|
||||||
|
if ( scheme )
|
||||||
|
{
|
||||||
|
scheme->setShowSchemeInMenu( state );
|
||||||
|
}
|
||||||
|
} );
|
||||||
|
|
||||||
|
QMenu *schemeMenu = new QMenu( mSchemeToolButton );
|
||||||
|
schemeMenu->addAction( mActionNewPalette );
|
||||||
|
schemeMenu->addAction( mActionImportPalette );
|
||||||
|
schemeMenu->addAction( mActionRemovePalette );
|
||||||
|
schemeMenu->addSeparator();
|
||||||
|
schemeMenu->addAction( mActionShowInButtons );
|
||||||
|
mSchemeToolButton->setMenu( schemeMenu );
|
||||||
|
|
||||||
//find custom color scheme from registry
|
//find custom color scheme from registry
|
||||||
refreshSchemeComboBox();
|
refreshSchemeComboBox();
|
||||||
QList<QgsCustomColorScheme *> customSchemes;
|
QList<QgsCustomColorScheme *> customSchemes;
|
||||||
@ -762,6 +822,7 @@ QgsOptions::QgsOptions( QWidget *parent, Qt::WindowFlags fl, const QList<QgsOpti
|
|||||||
{
|
{
|
||||||
mTreeCustomColors->setScheme( customSchemes.at( 0 ) );
|
mTreeCustomColors->setScheme( customSchemes.at( 0 ) );
|
||||||
mColorSchemesComboBox->setCurrentIndex( mColorSchemesComboBox->findText( customSchemes.at( 0 )->schemeName() ) );
|
mColorSchemesComboBox->setCurrentIndex( mColorSchemesComboBox->findText( customSchemes.at( 0 )->schemeName() ) );
|
||||||
|
updateActionsForCurrentColorScheme( customSchemes.at( 0 ) );
|
||||||
}
|
}
|
||||||
connect( mColorSchemesComboBox, static_cast<void ( QComboBox::* )( int )>( &QComboBox::currentIndexChanged ), this, [ = ]( int index )
|
connect( mColorSchemesComboBox, static_cast<void ( QComboBox::* )( int )>( &QComboBox::currentIndexChanged ), this, [ = ]( int index )
|
||||||
{
|
{
|
||||||
@ -774,8 +835,9 @@ QgsOptions::QgsOptions( QWidget *parent, Qt::WindowFlags fl, const QList<QgsOpti
|
|||||||
QgsColorScheme *scheme = QgsApplication::colorSchemeRegistry()->schemes().value( index );
|
QgsColorScheme *scheme = QgsApplication::colorSchemeRegistry()->schemes().value( index );
|
||||||
if ( scheme )
|
if ( scheme )
|
||||||
mTreeCustomColors->setScheme( scheme );
|
mTreeCustomColors->setScheme( scheme );
|
||||||
} );
|
|
||||||
|
|
||||||
|
updateActionsForCurrentColorScheme( scheme );
|
||||||
|
} );
|
||||||
|
|
||||||
//
|
//
|
||||||
// Layout settings
|
// Layout settings
|
||||||
@ -2272,6 +2334,27 @@ void QgsOptions::refreshSchemeComboBox()
|
|||||||
mColorSchemesComboBox->blockSignals( false );
|
mColorSchemesComboBox->blockSignals( false );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void QgsOptions::updateActionsForCurrentColorScheme( QgsColorScheme *scheme )
|
||||||
|
{
|
||||||
|
mButtonImportColors->setEnabled( scheme->isEditable() );
|
||||||
|
mButtonPasteColors->setEnabled( scheme->isEditable() );
|
||||||
|
mButtonAddColor->setEnabled( scheme->isEditable() );
|
||||||
|
mButtonRemoveColor->setEnabled( scheme->isEditable() );
|
||||||
|
|
||||||
|
QgsUserColorScheme *userScheme = dynamic_cast<QgsUserColorScheme *>( scheme );
|
||||||
|
mActionRemovePalette->setEnabled( static_cast< bool >( userScheme ) && userScheme->isEditable() );
|
||||||
|
if ( userScheme )
|
||||||
|
{
|
||||||
|
mActionShowInButtons->setEnabled( true );
|
||||||
|
whileBlocking( mActionShowInButtons )->setChecked( userScheme->flags() & QgsColorScheme::ShowInColorButtonMenu );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
whileBlocking( mActionShowInButtons )->setChecked( false );
|
||||||
|
mActionShowInButtons->setEnabled( false );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void QgsOptions::scaleItemChanged( QListWidgetItem *changedScaleItem )
|
void QgsOptions::scaleItemChanged( QListWidgetItem *changedScaleItem )
|
||||||
{
|
{
|
||||||
// Check if the new value is valid, restore the old value if not.
|
// Check if the new value is valid, restore the old value if not.
|
||||||
|
|||||||
@ -264,6 +264,10 @@ class APP_EXPORT QgsOptions : public QgsOptionsDialogBase, private Ui::QgsOption
|
|||||||
|
|
||||||
QList< QgsOptionsPageWidget * > mAdditionalOptionWidgets;
|
QList< QgsOptionsPageWidget * > mAdditionalOptionWidgets;
|
||||||
QgsLocatorOptionsWidget *mLocatorOptionsWidget = nullptr;
|
QgsLocatorOptionsWidget *mLocatorOptionsWidget = nullptr;
|
||||||
|
|
||||||
|
void updateActionsForCurrentColorScheme( QgsColorScheme *scheme );
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // #ifndef QGSOPTIONS_H
|
#endif // #ifndef QGSOPTIONS_H
|
||||||
|
|||||||
@ -303,8 +303,6 @@ QgsUserColorScheme::QgsUserColorScheme( const QString &filename )
|
|||||||
: mFilename( filename )
|
: mFilename( filename )
|
||||||
{
|
{
|
||||||
QFile sourceFile( gplFilePath() );
|
QFile sourceFile( gplFilePath() );
|
||||||
QFileInfo sourceFileInfo( gplFilePath() );
|
|
||||||
mEditable = sourceFileInfo.isWritable();
|
|
||||||
|
|
||||||
//read in name
|
//read in name
|
||||||
if ( sourceFile.open( QIODevice::ReadOnly ) )
|
if ( sourceFile.open( QIODevice::ReadOnly ) )
|
||||||
@ -394,7 +392,7 @@ void QgsUserColorScheme::setShowSchemeInMenu( bool show )
|
|||||||
|
|
||||||
QString QgsUserColorScheme::gplFilePath()
|
QString QgsUserColorScheme::gplFilePath()
|
||||||
{
|
{
|
||||||
QString palettesDir = QgsApplication::qgisSettingsDirPath() + "/palettes";
|
QString palettesDir = QgsApplication::qgisSettingsDirPath() + "palettes";
|
||||||
|
|
||||||
QDir localDir;
|
QDir localDir;
|
||||||
if ( !localDir.mkpath( palettesDir ) )
|
if ( !localDir.mkpath( palettesDir ) )
|
||||||
|
|||||||
@ -64,7 +64,7 @@ void QgsColorSchemeRegistry::initStyleScheme()
|
|||||||
|
|
||||||
void QgsColorSchemeRegistry::addUserSchemes()
|
void QgsColorSchemeRegistry::addUserSchemes()
|
||||||
{
|
{
|
||||||
QString palettesDir = QgsApplication::qgisSettingsDirPath() + "/palettes";
|
QString palettesDir = QgsApplication::qgisSettingsDirPath() + "palettes";
|
||||||
|
|
||||||
QDir localDir;
|
QDir localDir;
|
||||||
if ( !localDir.mkpath( palettesDir ) )
|
if ( !localDir.mkpath( palettesDir ) )
|
||||||
|
|||||||
@ -280,15 +280,17 @@ void QgsCompoundColorWidget::refreshSchemeComboBox()
|
|||||||
mSchemeComboBox->blockSignals( false );
|
mSchemeComboBox->blockSignals( false );
|
||||||
}
|
}
|
||||||
|
|
||||||
void QgsCompoundColorWidget::importPalette()
|
|
||||||
|
QgsUserColorScheme *QgsCompoundColorWidget::importUserPaletteFromFile( QWidget *parent )
|
||||||
{
|
{
|
||||||
QgsSettings s;
|
QgsSettings s;
|
||||||
QString lastDir = s.value( QStringLiteral( "/UI/lastGplPaletteDir" ), QDir::homePath() ).toString();
|
QString lastDir = s.value( QStringLiteral( "/UI/lastGplPaletteDir" ), QDir::homePath() ).toString();
|
||||||
QString filePath = QFileDialog::getOpenFileName( this, tr( "Select Palette File" ), lastDir, QStringLiteral( "GPL (*.gpl);;All files (*.*)" ) );
|
QString filePath = QFileDialog::getOpenFileName( parent, tr( "Select Palette File" ), lastDir, QStringLiteral( "GPL (*.gpl);;All files (*.*)" ) );
|
||||||
activateWindow();
|
if ( parent )
|
||||||
|
parent->activateWindow();
|
||||||
if ( filePath.isEmpty() )
|
if ( filePath.isEmpty() )
|
||||||
{
|
{
|
||||||
return;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
//check if file exists
|
//check if file exists
|
||||||
@ -296,7 +298,7 @@ void QgsCompoundColorWidget::importPalette()
|
|||||||
if ( !fileInfo.exists() || !fileInfo.isReadable() )
|
if ( !fileInfo.exists() || !fileInfo.isReadable() )
|
||||||
{
|
{
|
||||||
QMessageBox::critical( nullptr, tr( "Import Color Palette" ), tr( "Error, file does not exist or is not readable." ) );
|
QMessageBox::critical( nullptr, tr( "Import Color Palette" ), tr( "Error, file does not exist or is not readable." ) );
|
||||||
return;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
s.setValue( QStringLiteral( "/UI/lastGplPaletteDir" ), fileInfo.absolutePath() );
|
s.setValue( QStringLiteral( "/UI/lastGplPaletteDir" ), fileInfo.absolutePath() );
|
||||||
@ -309,14 +311,14 @@ void QgsCompoundColorWidget::importPalette()
|
|||||||
if ( !ok )
|
if ( !ok )
|
||||||
{
|
{
|
||||||
QMessageBox::critical( nullptr, tr( "Import Color Palette" ), tr( "Palette file is not readable." ) );
|
QMessageBox::critical( nullptr, tr( "Import Color Palette" ), tr( "Palette file is not readable." ) );
|
||||||
return;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( importedColors.length() == 0 )
|
if ( importedColors.length() == 0 )
|
||||||
{
|
{
|
||||||
//no imported colors
|
//no imported colors
|
||||||
QMessageBox::critical( nullptr, tr( "Import Color Palette" ), tr( "No colors found in palette file." ) );
|
QMessageBox::critical( nullptr, tr( "Import Color Palette" ), tr( "No colors found in palette file." ) );
|
||||||
return;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
//TODO - handle conflicting file names, name for new palette
|
//TODO - handle conflicting file names, name for new palette
|
||||||
@ -325,10 +327,40 @@ void QgsCompoundColorWidget::importPalette()
|
|||||||
importedScheme->setColors( importedColors );
|
importedScheme->setColors( importedColors );
|
||||||
|
|
||||||
QgsApplication::colorSchemeRegistry()->addColorScheme( importedScheme );
|
QgsApplication::colorSchemeRegistry()->addColorScheme( importedScheme );
|
||||||
|
return importedScheme;
|
||||||
|
}
|
||||||
|
|
||||||
//refresh combobox
|
void QgsCompoundColorWidget::importPalette()
|
||||||
refreshSchemeComboBox();
|
{
|
||||||
mSchemeComboBox->setCurrentIndex( mSchemeComboBox->count() - 1 );
|
if ( importUserPaletteFromFile( this ) )
|
||||||
|
{
|
||||||
|
//refresh combobox
|
||||||
|
refreshSchemeComboBox();
|
||||||
|
mSchemeComboBox->setCurrentIndex( mSchemeComboBox->count() - 1 );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool QgsCompoundColorWidget::removeUserPalette( QgsUserColorScheme *scheme, QWidget *parent )
|
||||||
|
{
|
||||||
|
if ( QMessageBox::question( parent, tr( "Remove Color Palette" ),
|
||||||
|
QString( tr( "Are you sure you want to remove %1?" ) ).arg( scheme->schemeName() ),
|
||||||
|
QMessageBox::Yes | QMessageBox::No, QMessageBox::No ) != QMessageBox::Yes )
|
||||||
|
{
|
||||||
|
//user canceled
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
//remove palette and associated gpl file
|
||||||
|
if ( !scheme->erase() )
|
||||||
|
{
|
||||||
|
//something went wrong
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
//remove scheme from registry
|
||||||
|
QgsApplication::colorSchemeRegistry()->removeColorScheme( scheme );
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void QgsCompoundColorWidget::removePalette()
|
void QgsCompoundColorWidget::removePalette()
|
||||||
@ -348,41 +380,27 @@ void QgsCompoundColorWidget::removePalette()
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( QMessageBox::question( this, tr( "Remove Color Palette" ),
|
if ( removeUserPalette( userScheme, this ) )
|
||||||
QString( tr( "Are you sure you want to remove %1?" ) ).arg( userScheme->schemeName() ),
|
|
||||||
QMessageBox::Yes | QMessageBox::No, QMessageBox::No ) != QMessageBox::Yes )
|
|
||||||
{
|
{
|
||||||
//user canceled
|
refreshSchemeComboBox();
|
||||||
return;
|
prevIndex = std::max( std::min( prevIndex, mSchemeComboBox->count() - 1 ), 0 );
|
||||||
|
mSchemeComboBox->setCurrentIndex( prevIndex );
|
||||||
}
|
}
|
||||||
|
|
||||||
//remove palette and associated gpl file
|
|
||||||
if ( !userScheme->erase() )
|
|
||||||
{
|
|
||||||
//something went wrong
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
//remove scheme from registry
|
|
||||||
QgsApplication::colorSchemeRegistry()->removeColorScheme( userScheme );
|
|
||||||
refreshSchemeComboBox();
|
|
||||||
prevIndex = std::max( std::min( prevIndex, mSchemeComboBox->count() - 1 ), 0 );
|
|
||||||
mSchemeComboBox->setCurrentIndex( prevIndex );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void QgsCompoundColorWidget::newPalette()
|
QgsUserColorScheme *QgsCompoundColorWidget::createNewUserPalette( QWidget *parent )
|
||||||
{
|
{
|
||||||
bool ok = false;
|
bool ok = false;
|
||||||
QString name = QInputDialog::getText( this, tr( "Create New Palette" ), tr( "Enter a name for the new palette:" ),
|
QString name = QInputDialog::getText( parent, tr( "Create New Palette" ), tr( "Enter a name for the new palette:" ),
|
||||||
QLineEdit::Normal, tr( "New palette" ), &ok );
|
QLineEdit::Normal, tr( "New palette" ), &ok );
|
||||||
|
|
||||||
if ( !ok || name.isEmpty() )
|
if ( !ok || name.isEmpty() )
|
||||||
{
|
{
|
||||||
//user canceled
|
//user canceled
|
||||||
return;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
//generate file name for new palette
|
//generate file name for new palette
|
||||||
QDir palettePath( gplFilePath() );
|
QDir palettePath( gplFilePath() );
|
||||||
QRegExp badChars( "[,^@={}\\[\\]~!?:&*\"|#%<>$\"'();`' /\\\\]" );
|
QRegExp badChars( "[,^@={}\\[\\]~!?:&*\"|#%<>$\"'();`' /\\\\]" );
|
||||||
QString filename = name.simplified().toLower().replace( badChars, QStringLiteral( "_" ) );
|
QString filename = name.simplified().toLower().replace( badChars, QStringLiteral( "_" ) );
|
||||||
@ -403,15 +421,22 @@ void QgsCompoundColorWidget::newPalette()
|
|||||||
newScheme->setName( name );
|
newScheme->setName( name );
|
||||||
|
|
||||||
QgsApplication::colorSchemeRegistry()->addColorScheme( newScheme );
|
QgsApplication::colorSchemeRegistry()->addColorScheme( newScheme );
|
||||||
|
return newScheme;
|
||||||
|
}
|
||||||
|
|
||||||
//refresh combobox and set new scheme as active
|
void QgsCompoundColorWidget::newPalette()
|
||||||
refreshSchemeComboBox();
|
{
|
||||||
mSchemeComboBox->setCurrentIndex( mSchemeComboBox->count() - 1 );
|
if ( createNewUserPalette( this ) )
|
||||||
|
{
|
||||||
|
//refresh combobox and set new scheme as active
|
||||||
|
refreshSchemeComboBox();
|
||||||
|
mSchemeComboBox->setCurrentIndex( mSchemeComboBox->count() - 1 );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
QString QgsCompoundColorWidget::gplFilePath()
|
QString QgsCompoundColorWidget::gplFilePath()
|
||||||
{
|
{
|
||||||
QString palettesDir = QgsApplication::qgisSettingsDirPath() + "/palettes";
|
QString palettesDir = QgsApplication::qgisSettingsDirPath() + "palettes";
|
||||||
|
|
||||||
QDir localDir;
|
QDir localDir;
|
||||||
if ( !localDir.mkpath( palettesDir ) )
|
if ( !localDir.mkpath( palettesDir ) )
|
||||||
|
|||||||
@ -76,6 +76,42 @@ class GUI_EXPORT QgsCompoundColorWidget : public QgsPanelWidget, private Ui::Qgs
|
|||||||
*/
|
*/
|
||||||
void setDiscarded( bool discarded ) { mDiscarded = discarded; }
|
void setDiscarded( bool discarded ) { mDiscarded = discarded; }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Triggers a user prompt for importing a new color scheme from an existing GPL file.
|
||||||
|
*
|
||||||
|
* The \a parent argument must be set to a valid parent widget for the dialog prompts.
|
||||||
|
*
|
||||||
|
* \since QGIS 3.2
|
||||||
|
*
|
||||||
|
* \see createNewUserPalette()
|
||||||
|
* \see removeUserPalette()
|
||||||
|
*/
|
||||||
|
static QgsUserColorScheme *importUserPaletteFromFile( QWidget *parent );
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Triggers a user prompt for creating a new user color scheme.
|
||||||
|
*
|
||||||
|
* The \a parent argument must be set to a valid parent widget for the dialog prompts.
|
||||||
|
*
|
||||||
|
* \since QGIS 3.2
|
||||||
|
*
|
||||||
|
* \see importUserPaletteFromFile()
|
||||||
|
* \see removeUserPalette()
|
||||||
|
*/
|
||||||
|
static QgsUserColorScheme *createNewUserPalette( QWidget *parent );
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Triggers a user prompt for removing an existing user color \a scheme.
|
||||||
|
*
|
||||||
|
* The \a parent argument must be set to a valid parent widget for the dialog prompts.
|
||||||
|
*
|
||||||
|
* \since QGIS 3.2
|
||||||
|
*
|
||||||
|
* \see importUserPaletteFromFile()
|
||||||
|
* \see createNewUserPalette()
|
||||||
|
*/
|
||||||
|
static bool removeUserPalette( QgsUserColorScheme *scheme, QWidget *parent );
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -182,7 +218,7 @@ class GUI_EXPORT QgsCompoundColorWidget : public QgsPanelWidget, private Ui::Qgs
|
|||||||
/**
|
/**
|
||||||
* Returns the path to the user's palette folder
|
* Returns the path to the user's palette folder
|
||||||
*/
|
*/
|
||||||
QString gplFilePath();
|
static QString gplFilePath();
|
||||||
|
|
||||||
//! Updates the state of actions for the current selected scheme
|
//! Updates the state of actions for the current selected scheme
|
||||||
void updateActionsForCurrentScheme();
|
void updateActionsForCurrentScheme();
|
||||||
|
|||||||
@ -320,7 +320,7 @@
|
|||||||
<item>
|
<item>
|
||||||
<widget class="QStackedWidget" name="mOptionsStackedWidget">
|
<widget class="QStackedWidget" name="mOptionsStackedWidget">
|
||||||
<property name="currentIndex">
|
<property name="currentIndex">
|
||||||
<number>0</number>
|
<number>7</number>
|
||||||
</property>
|
</property>
|
||||||
<widget class="QWidget" name="mOptionsPageGeneral">
|
<widget class="QWidget" name="mOptionsPageGeneral">
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_3">
|
<layout class="QVBoxLayout" name="verticalLayout_3">
|
||||||
@ -1040,7 +1040,7 @@
|
|||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>579</width>
|
<width>843</width>
|
||||||
<height>1110</height>
|
<height>1110</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
@ -1576,8 +1576,8 @@
|
|||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>593</width>
|
<width>857</width>
|
||||||
<height>387</height>
|
<height>826</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QGridLayout" name="gridLayout_15">
|
<layout class="QGridLayout" name="gridLayout_15">
|
||||||
@ -1743,8 +1743,8 @@
|
|||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>531</width>
|
<width>857</width>
|
||||||
<height>787</height>
|
<height>826</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_27">
|
<layout class="QVBoxLayout" name="verticalLayout_27">
|
||||||
@ -2111,7 +2111,7 @@
|
|||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>713</width>
|
<width>843</width>
|
||||||
<height>1110</height>
|
<height>1110</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
@ -2862,8 +2862,8 @@
|
|||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>523</width>
|
<width>857</width>
|
||||||
<height>246</height>
|
<height>826</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_25">
|
<layout class="QVBoxLayout" name="verticalLayout_25">
|
||||||
@ -3119,8 +3119,8 @@
|
|||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>640</width>
|
<width>857</width>
|
||||||
<height>660</height>
|
<height>826</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_30">
|
<layout class="QVBoxLayout" name="verticalLayout_30">
|
||||||
@ -3563,8 +3563,8 @@ The bigger the number, the faster zooming with the mouse wheel will be.</string>
|
|||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>151</width>
|
<width>857</width>
|
||||||
<height>239</height>
|
<height>826</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout_46">
|
<layout class="QHBoxLayout" name="horizontalLayout_46">
|
||||||
@ -3601,6 +3601,13 @@ The bigger the number, the faster zooming with the mouse wheel will be.</string>
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item row="1" column="0" rowspan="8">
|
||||||
|
<widget class="QgsColorSchemeList" name="mTreeCustomColors" native="true">
|
||||||
|
<property name="focusPolicy">
|
||||||
|
<enum>Qt::StrongFocus</enum>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
<item row="4" column="1">
|
<item row="4" column="1">
|
||||||
<widget class="QToolButton" name="mButtonPasteColors">
|
<widget class="QToolButton" name="mButtonPasteColors">
|
||||||
<property name="toolTip">
|
<property name="toolTip">
|
||||||
@ -3629,13 +3636,6 @@ The bigger the number, the faster zooming with the mouse wheel will be.</string>
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="1" column="0" rowspan="8">
|
|
||||||
<widget class="QgsColorSchemeList" name="mTreeCustomColors" native="true">
|
|
||||||
<property name="focusPolicy">
|
|
||||||
<enum>Qt::StrongFocus</enum>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="2" column="1">
|
<item row="2" column="1">
|
||||||
<widget class="QToolButton" name="mButtonRemoveColor">
|
<widget class="QToolButton" name="mButtonRemoveColor">
|
||||||
<property name="toolTip">
|
<property name="toolTip">
|
||||||
@ -3664,6 +3664,13 @@ The bigger the number, the faster zooming with the mouse wheel will be.</string>
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item row="0" column="0">
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout_22">
|
||||||
|
<item>
|
||||||
|
<widget class="QComboBox" name="mColorSchemesComboBox"/>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
<item row="6" column="1">
|
<item row="6" column="1">
|
||||||
<widget class="QToolButton" name="mButtonExportColors">
|
<widget class="QToolButton" name="mButtonExportColors">
|
||||||
<property name="toolTip">
|
<property name="toolTip">
|
||||||
@ -3678,12 +3685,15 @@ The bigger the number, the faster zooming with the mouse wheel will be.</string>
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="0" column="0">
|
<item row="0" column="1">
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout_22">
|
<widget class="QToolButton" name="mSchemeToolButton">
|
||||||
<item>
|
<property name="text">
|
||||||
<widget class="QComboBox" name="mColorSchemesComboBox"/>
|
<string>…</string>
|
||||||
</item>
|
</property>
|
||||||
</layout>
|
<property name="popupMode">
|
||||||
|
<enum>QToolButton::InstantPopup</enum>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
@ -5259,9 +5269,53 @@ The bigger the number, the faster zooming with the mouse wheel will be.</string>
|
|||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
|
<action name="mActionImportPalette">
|
||||||
|
<property name="text">
|
||||||
|
<string>Import Palette...</string>
|
||||||
|
</property>
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>Import palette from file</string>
|
||||||
|
</property>
|
||||||
|
</action>
|
||||||
|
<action name="mActionRemovePalette">
|
||||||
|
<property name="text">
|
||||||
|
<string>Remove Palette</string>
|
||||||
|
</property>
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>Remove current palette</string>
|
||||||
|
</property>
|
||||||
|
</action>
|
||||||
|
<action name="mActionNewPalette">
|
||||||
|
<property name="text">
|
||||||
|
<string>New Palette...</string>
|
||||||
|
</property>
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>Create a new palette</string>
|
||||||
|
</property>
|
||||||
|
</action>
|
||||||
|
<action name="mActionShowInButtons">
|
||||||
|
<property name="checkable">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Show in Color Buttons</string>
|
||||||
|
</property>
|
||||||
|
</action>
|
||||||
</widget>
|
</widget>
|
||||||
<layoutdefault spacing="6" margin="11"/>
|
<layoutdefault spacing="6" margin="11"/>
|
||||||
<customwidgets>
|
<customwidgets>
|
||||||
|
<customwidget>
|
||||||
|
<class>QgsColorButton</class>
|
||||||
|
<extends>QToolButton</extends>
|
||||||
|
<header>qgscolorbutton.h</header>
|
||||||
|
<container>1</container>
|
||||||
|
</customwidget>
|
||||||
|
<customwidget>
|
||||||
|
<class>QgsColorSchemeList</class>
|
||||||
|
<extends>QWidget</extends>
|
||||||
|
<header location="global">qgscolorschemelist.h</header>
|
||||||
|
<container>1</container>
|
||||||
|
</customwidget>
|
||||||
<customwidget>
|
<customwidget>
|
||||||
<class>QgsCollapsibleGroupBox</class>
|
<class>QgsCollapsibleGroupBox</class>
|
||||||
<extends>QGroupBox</extends>
|
<extends>QGroupBox</extends>
|
||||||
@ -5280,12 +5334,6 @@ The bigger the number, the faster zooming with the mouse wheel will be.</string>
|
|||||||
<header>qgsprojectionselectionwidget.h</header>
|
<header>qgsprojectionselectionwidget.h</header>
|
||||||
<container>1</container>
|
<container>1</container>
|
||||||
</customwidget>
|
</customwidget>
|
||||||
<customwidget>
|
|
||||||
<class>QgsColorButton</class>
|
|
||||||
<extends>QToolButton</extends>
|
|
||||||
<header>qgscolorbutton.h</header>
|
|
||||||
<container>1</container>
|
|
||||||
</customwidget>
|
|
||||||
<customwidget>
|
<customwidget>
|
||||||
<class>QgsSpinBox</class>
|
<class>QgsSpinBox</class>
|
||||||
<extends>QSpinBox</extends>
|
<extends>QSpinBox</extends>
|
||||||
@ -5307,12 +5355,6 @@ The bigger the number, the faster zooming with the mouse wheel will be.</string>
|
|||||||
<extends>QLineEdit</extends>
|
<extends>QLineEdit</extends>
|
||||||
<header>qgsfilterlineedit.h</header>
|
<header>qgsfilterlineedit.h</header>
|
||||||
</customwidget>
|
</customwidget>
|
||||||
<customwidget>
|
|
||||||
<class>QgsColorSchemeList</class>
|
|
||||||
<extends>QWidget</extends>
|
|
||||||
<header location="global">qgscolorschemelist.h</header>
|
|
||||||
<container>1</container>
|
|
||||||
</customwidget>
|
|
||||||
<customwidget>
|
<customwidget>
|
||||||
<class>QgsSettingsTree</class>
|
<class>QgsSettingsTree</class>
|
||||||
<extends>QWidget</extends>
|
<extends>QWidget</extends>
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user