mirror of
https://github.com/qgis/QGIS.git
synced 2025-02-25 00:58:06 -05:00
Fix trying to create new color ramp from first page in style
manager dialog does nothing
This commit is contained in:
parent
1d5bfb2cfe
commit
34fb646f7a
@ -226,7 +226,7 @@ Context menu for the listItems ( symbols list )
|
||||
%End
|
||||
|
||||
protected slots:
|
||||
bool addColorRamp( QAction *action );
|
||||
bool addColorRamp( const QString &type = QString() );
|
||||
void addFavoriteSelectedSymbols();
|
||||
%Docstring
|
||||
Add selected symbols to favorites
|
||||
@ -288,10 +288,6 @@ Populates the list view with color ramps of the current type with the given name
|
||||
bool addSymbol( int symbolType = -1 );
|
||||
%Docstring
|
||||
add a new symbol to style
|
||||
%End
|
||||
bool addColorRamp();
|
||||
%Docstring
|
||||
add a new color ramp to style
|
||||
%End
|
||||
|
||||
bool editSymbol();
|
||||
|
@ -346,12 +346,19 @@ QgsStyleManagerDialog::QgsStyleManagerDialog( QgsStyle *style, QWidget *parent,
|
||||
connect( item, &QAction::triggered, this, [ = ]( bool ) { addSymbol( QgsSymbol::Fill ); } );
|
||||
mMenuBtnAddItemAll->addAction( item );
|
||||
mMenuBtnAddItemAll->addSeparator();
|
||||
for ( const QString &rampType : qgis::as_const( rampTypes ) )
|
||||
for ( const std::pair< QString, QString > &rampType :
|
||||
{
|
||||
std::pair< QString, QString > { tr( "Gradient…" ), tr( "Gradient" ) },
|
||||
std::pair< QString, QString > { tr( "Color presets…" ), tr( "Color presets" ) },
|
||||
std::pair< QString, QString > { tr( "Random…" ), tr( "Random" ) },
|
||||
std::pair< QString, QString > { tr( "Catalog: cpt-city…" ), tr( "Catalog: cpt-city" ) },
|
||||
std::pair< QString, QString > { tr( "Catalog: ColorBrewer…" ), tr( "Catalog: ColorBrewer" ) }
|
||||
} )
|
||||
{
|
||||
item = new QAction( QgsApplication::getThemeIcon( QStringLiteral( "styleicons/color.svg" ) ), rampType, this );
|
||||
connect( item, &QAction::triggered, this, [ = ]( bool ) { addColorRamp( item ); } );
|
||||
item = new QAction( QgsApplication::getThemeIcon( QStringLiteral( "styleicons/color.svg" ) ), rampType.first, this );
|
||||
connect( item, &QAction::triggered, this, [ = ]( bool ) { addColorRamp( rampType.second ); } );
|
||||
mMenuBtnAddItemAll->addAction( item );
|
||||
mMenuBtnAddItemColorRamp->addAction( new QAction( rampType, this ) );
|
||||
mMenuBtnAddItemColorRamp->addAction( new QAction( rampType.first, this ) );
|
||||
}
|
||||
mMenuBtnAddItemAll->addSeparator();
|
||||
item = new QAction( QgsApplication::getThemeIcon( QStringLiteral( "mIconFieldText.svg" ) ), tr( "Text Format…" ), this );
|
||||
@ -400,7 +407,7 @@ QgsStyleManagerDialog::QgsStyleManagerDialog( QgsStyle *style, QWidget *parent,
|
||||
mMenuBtnAddItemSymbol3D->addAction( item );
|
||||
|
||||
connect( mMenuBtnAddItemColorRamp, &QMenu::triggered,
|
||||
this, static_cast<bool ( QgsStyleManagerDialog::* )( QAction * )>( &QgsStyleManagerDialog::addColorRamp ) );
|
||||
this, [ = ]( QAction * action ) { addColorRamp( action->data().toString() ); } );
|
||||
}
|
||||
|
||||
// Context menu for symbols/colorramps. The menu entries for every group are created when displaying the menu.
|
||||
@ -1519,16 +1526,10 @@ void QgsStyleManagerDialog::activate()
|
||||
activateWindow();
|
||||
}
|
||||
|
||||
bool QgsStyleManagerDialog::addColorRamp()
|
||||
{
|
||||
return addColorRamp( nullptr );
|
||||
}
|
||||
|
||||
bool QgsStyleManagerDialog::addColorRamp( QAction *action )
|
||||
bool QgsStyleManagerDialog::addColorRamp( const QString &type )
|
||||
{
|
||||
// pass the action text, which is the color ramp type
|
||||
QString rampName = addColorRampStatic( this, mStyle,
|
||||
action ? action->text() : QString() );
|
||||
QString rampName = addColorRampStatic( this, mStyle, type );
|
||||
if ( !rampName.isEmpty() )
|
||||
{
|
||||
mModified = true;
|
||||
|
@ -254,7 +254,7 @@ class GUI_EXPORT QgsStyleManagerDialog : public QDialog, private Ui::QgsStyleMan
|
||||
void listitemsContextMenu( QPoint );
|
||||
|
||||
protected slots:
|
||||
bool addColorRamp( QAction *action );
|
||||
bool addColorRamp( const QString &type = QString() );
|
||||
//! Add selected symbols to favorites
|
||||
void addFavoriteSelectedSymbols();
|
||||
//! Remove selected symbols from favorites
|
||||
@ -300,8 +300,6 @@ class GUI_EXPORT QgsStyleManagerDialog : public QDialog, private Ui::QgsStyleMan
|
||||
|
||||
//! add a new symbol to style
|
||||
bool addSymbol( int symbolType = -1 );
|
||||
//! add a new color ramp to style
|
||||
bool addColorRamp();
|
||||
|
||||
bool editSymbol();
|
||||
bool editColorRamp();
|
||||
|
Loading…
x
Reference in New Issue
Block a user