mirror of
https://github.com/qgis/QGIS.git
synced 2025-02-22 00:06:12 -05:00
Expose option to color lock symbol layers for selected features
in GUI
This commit is contained in:
parent
b168b20516
commit
9b0829905b
@ -990,6 +990,10 @@
|
||||
<file>themes/default/mActionAddTiledSceneLayer.svg</file>
|
||||
<file>themes/default/mIconTiledScene.svg</file>
|
||||
<file>themes/default/mIconTiledSceneLayer.svg</file>
|
||||
<file>themes/default/mIconColorUnlocked.svg</file>
|
||||
<file>themes/default/mIconColorLocked.svg</file>
|
||||
<file>themes/default/mIconSelectUnlocked.svg</file>
|
||||
<file>themes/default/mIconSelectLocked.svg</file>
|
||||
</qresource>
|
||||
<qresource prefix="/images/tips">
|
||||
<file alias="symbol_levels.png">qgis_tips/symbol_levels.png</file>
|
||||
|
1
images/themes/default/mIconColorLocked.svg
Normal file
1
images/themes/default/mIconColorLocked.svg
Normal file
@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16"><g style="stroke-width:1.33181"><path fill="#eb3131" d="M.48-16.85a7 7 0 0 1-2.05 4.949l-4.95-4.95z" style="stroke-width:1.33181" transform="rotate(60 -15.695 6.46) scale(.75086)"/><path fill="#b11c2d" d="M-9.526-7.305a7 7 0 0 1-2.05 4.95l-4.95-4.95z" style="stroke-width:1.33181" transform="rotate(105 -7.58 7.546) scale(.75086)"/><path fill="#e47acd" d="M-9.85 6.52a7 7 0 0 1-2.051 4.95l-4.95-4.95Z" style="stroke-width:1.33181" transform="rotate(150 -3.38 8.109) scale(.75086)"/><path fill="#6994d3" d="M-.305 16.526a7 7 0 0 1-2.05 4.95l-4.95-4.95Z" style="stroke-width:1.33181" transform="rotate(-165.001 -.02 8.56) scale(.75086)"/><path fill="#3eae35" d="M13.52 16.85a7 7 0 0 1-2.05 4.95l-4.95-4.95Z" style="stroke-width:1.33181" transform="rotate(-120 3.73 9.062) scale(.75086)"/><path fill="#89df34" d="M23.526 7.305a7 7 0 0 1-2.05 4.95l-4.95-4.95Z" style="stroke-width:1.33181" transform="rotate(-75 9.834 9.88) scale(.75086)"/><path fill="#fce94f" d="M23.85-6.52a7 7 0 0 1-2.05 4.95l-4.95-4.95z" style="stroke-width:1.33181" transform="rotate(-30 30.263 12.616) scale(.75086)"/><path fill="#e4972d" d="M14.305-16.526a7 7 0 0 1-2.05 4.95l-4.95-4.95z" style="stroke-width:1.33181" transform="rotate(14.999 -65.014 -.15) scale(.75086)"/></g><path d="M10.42 3.05c-1.133.127-2.239.66-2.879 1.632-.76 1.153-.865 2.42-.908 3.802l-.035 1.131a1.91 1.91 0 0 0-.098.6v1.281a5.256 5.256 0 0 0 2.385-.687c.922-.538 1.853-1.34 2.367-2.921a5.186 5.186 0 0 0-.443-4.26 5.256 5.256 0 0 0-.39-.577Z" style="color:#000;opacity:.968444;fill:#f9f9f9;stroke-linecap:square;stroke-linejoin:round;-inkscape-stroke:none"/><path fill="none" stroke="#888a85" stroke-linejoin="round" stroke-width="3" d="M8.632 8.547c.079-2.528.627-3.672 2.525-3.518 1.897.154 2.323 1.376 2.244 3.904" style="stroke-linecap:square"/><path fill="none" stroke="#eeeeec" stroke-linejoin="round" d="M8.623 8.547C8.7 6.019 9.25 4.846 11.147 5c1.897.154 2.324 1.405 2.245 3.933" style="stroke-width:1;stroke-linecap:square"/><rect width="7" height="5" x="7.5" y="9.5" fill="#f1db1e" stroke="#c4a000" rx=".538" ry=".714" style="stroke-width:1;stroke-linecap:square"/></svg>
|
After Width: | Height: | Size: 2.1 KiB |
1
images/themes/default/mIconColorUnlocked.svg
Normal file
1
images/themes/default/mIconColorUnlocked.svg
Normal file
@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16"><g style="stroke-width:1.33181"><path fill="#eb3131" d="M.48-16.85a7 7 0 0 1-2.05 4.949l-4.95-4.95z" style="stroke-width:1.33181" transform="rotate(60 -15.695 6.46) scale(.75086)"/><path fill="#b11c2d" d="M-9.526-7.305a7 7 0 0 1-2.05 4.95l-4.95-4.95z" style="stroke-width:1.33181" transform="rotate(105 -7.58 7.546) scale(.75086)"/><path fill="#e47acd" d="M-9.85 6.52a7 7 0 0 1-2.051 4.95l-4.95-4.95Z" style="stroke-width:1.33181" transform="rotate(150 -3.38 8.109) scale(.75086)"/><path fill="#6994d3" d="M-.305 16.526a7 7 0 0 1-2.05 4.95l-4.95-4.95Z" style="stroke-width:1.33181" transform="rotate(-165.001 -.02 8.56) scale(.75086)"/><path fill="#3eae35" d="M13.52 16.85a7 7 0 0 1-2.05 4.95l-4.95-4.95Z" style="stroke-width:1.33181" transform="rotate(-120 3.73 9.062) scale(.75086)"/><path fill="#89df34" d="M23.526 7.305a7 7 0 0 1-2.05 4.95l-4.95-4.95Z" style="stroke-width:1.33181" transform="rotate(-75 9.834 9.88) scale(.75086)"/><path fill="#fce94f" d="M23.85-6.52a7 7 0 0 1-2.05 4.95l-4.95-4.95z" style="stroke-width:1.33181" transform="rotate(-30 30.263 12.616) scale(.75086)"/><path fill="#e4972d" d="M14.305-16.526a7 7 0 0 1-2.05 4.95l-4.95-4.95z" style="stroke-width:1.33181" transform="rotate(14.999 -65.014 -.15) scale(.75086)"/></g><path d="M9.208 1.858c-.558.523-1.278 1.575-1.89 2.815l-.258.735c-.035.123.152 1.813.263 1.905.62.509 2.117 1.298 2.536 1.26 1.061-.108 1.321-.632 1.475-.989.617-1.584-.149-4.312-2.126-5.726Z" style="color:#000;opacity:.968444;fill:#f9f9f9;stroke-linecap:square;stroke-linejoin:round;-inkscape-stroke:none"/><path fill="none" stroke="#888a85" stroke-linejoin="round" stroke-width="3" d="M9.458 5.86c1.118-2.268 2.067-2.946 3.73-2.02 1.664.924 1.546 2.214.428 4.482" style="stroke-linecap:square"/><path fill="none" stroke="#eeeeec" stroke-linejoin="round" d="M9.45 5.857c1.117-2.269 2.102-3.11 3.766-2.184 1.663.925 1.723 2.214.158 5.289" style="stroke-width:1;stroke-linecap:square"/><rect width="7" height="5" x="7.5" y="9.5" fill="#f1db1e" stroke="#c4a000" rx=".538" ry=".714" style="stroke-width:1;stroke-linecap:square"/></svg>
|
After Width: | Height: | Size: 2.1 KiB |
1
images/themes/default/mIconSelectLocked.svg
Normal file
1
images/themes/default/mIconSelectLocked.svg
Normal file
@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16"><path fill="#fce94f" stroke="#c4a000" stroke-linecap="round" d="M1.5 1.5h9v9h-9z" style="stroke-width:1"/><path d="M11.014 2.994c-1.926-.06-2.833.716-3.473 1.688-.76 1.153-.865 2.42-.908 3.802l-.018.89c-.063.191-.12.635-.115.84l.019.805c.838-.035 4.527-.106 4.527-.106-.045-2.459.02-7.471-.032-7.92z" style="color:#000;opacity:.968444;fill:#f9f9f9;stroke-linecap:square;stroke-linejoin:round;-inkscape-stroke:none"/><path fill="none" stroke="#888a85" stroke-linejoin="round" stroke-width="3" d="M8.632 8.547c.079-2.528.627-3.672 2.525-3.518 1.897.154 2.323 1.376 2.244 3.904" style="stroke-linecap:square"/><path fill="none" stroke="#eeeeec" stroke-linejoin="round" d="M8.623 8.547C8.7 6.019 9.25 4.846 11.147 5c1.897.154 2.324 1.405 2.245 3.933" style="stroke-width:1;stroke-linecap:square"/><rect width="7" height="5" x="7.5" y="9.5" fill="#f1db1e" stroke="#c4a000" rx=".538" ry=".714" style="stroke-width:1;stroke-linecap:square"/></svg>
|
After Width: | Height: | Size: 1003 B |
1
images/themes/default/mIconSelectUnlocked.svg
Normal file
1
images/themes/default/mIconSelectUnlocked.svg
Normal file
@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16"><path fill="#fce94f" stroke="#c4a000" stroke-linecap="round" d="M1.5 1.5h9v9h-9z" style="stroke-width:1"/><path d="M10.992 1.341c-1.995.17-3.062 2.092-3.673 3.332l-.26.735c-.034.123.153 1.813.264 1.905.62.509 2.117 1.298 2.536 1.26C10.92 8.464 11 8.125 11 8.125s.038-5.3-.008-6.785z" style="color:#000;opacity:.968444;fill:#f9f9f9;stroke-linecap:square;stroke-linejoin:round;-inkscape-stroke:none"/><path fill="none" stroke="#888a85" stroke-linejoin="round" stroke-width="3" d="M9.458 5.86c1.118-2.268 2.067-2.946 3.73-2.02 1.664.924 1.546 2.214.428 4.482" style="stroke-linecap:square"/><path fill="none" stroke="#eeeeec" stroke-linejoin="round" d="M9.45 5.857c1.117-2.269 2.102-3.11 3.766-2.184 1.663.925 1.723 2.214.158 5.289" style="stroke-width:1;stroke-linecap:square"/><rect width="7" height="5" x="7.5" y="9.5" fill="#f1db1e" stroke="#c4a000" rx=".538" ry=".714" style="stroke-width:1;stroke-linecap:square"/></svg>
|
After Width: | Height: | Size: 986 B |
@ -273,7 +273,35 @@ QgsSymbolSelectorWidget::QgsSymbolSelectorWidget( QgsSymbol *symbol, QgsStyle *s
|
||||
iconLock.addFile( QgsApplication::iconPath( QStringLiteral( "locked.svg" ) ), QSize(), QIcon::Active, QIcon::On );
|
||||
iconLock.addFile( QgsApplication::iconPath( QStringLiteral( "unlocked.svg" ) ), QSize(), QIcon::Normal, QIcon::Off );
|
||||
iconLock.addFile( QgsApplication::iconPath( QStringLiteral( "unlocked.svg" ) ), QSize(), QIcon::Active, QIcon::Off );
|
||||
btnLock->setIcon( iconLock );
|
||||
|
||||
QIcon iconColorLock;
|
||||
iconColorLock.addFile( QgsApplication::iconPath( QStringLiteral( "mIconColorLocked.svg" ) ), QSize(), QIcon::Normal, QIcon::On );
|
||||
iconColorLock.addFile( QgsApplication::iconPath( QStringLiteral( "mIconColorLocked.svg" ) ), QSize(), QIcon::Active, QIcon::On );
|
||||
iconColorLock.addFile( QgsApplication::iconPath( QStringLiteral( "mIconColorUnlocked.svg" ) ), QSize(), QIcon::Normal, QIcon::Off );
|
||||
iconColorLock.addFile( QgsApplication::iconPath( QStringLiteral( "mIconColorUnlocked.svg" ) ), QSize(), QIcon::Active, QIcon::Off );
|
||||
|
||||
mLockColorAction = new QAction( tr( "Lock Color" ), this );
|
||||
mLockColorAction->setToolTip( tr( "Avoid changing the color of the layer when the symbol color is changed" ) );
|
||||
mLockColorAction->setCheckable( true );
|
||||
mLockColorAction->setIcon( iconColorLock );
|
||||
|
||||
QIcon iconSelectLock;
|
||||
iconSelectLock.addFile( QgsApplication::iconPath( QStringLiteral( "mIconSelectLocked.svg" ) ), QSize(), QIcon::Normal, QIcon::On );
|
||||
iconSelectLock.addFile( QgsApplication::iconPath( QStringLiteral( "mIconSelectLocked.svg" ) ), QSize(), QIcon::Active, QIcon::On );
|
||||
iconSelectLock.addFile( QgsApplication::iconPath( QStringLiteral( "mIconSelectUnlocked.svg" ) ), QSize(), QIcon::Normal, QIcon::Off );
|
||||
iconSelectLock.addFile( QgsApplication::iconPath( QStringLiteral( "mIconSelectUnlocked.svg" ) ), QSize(), QIcon::Active, QIcon::Off );
|
||||
|
||||
mLockSelectionColorAction = new QAction( tr( "Lock Color When Selected" ), this );
|
||||
mLockSelectionColorAction->setToolTip( tr( "Avoid changing the color of the layer when a feature is selected" ) );
|
||||
mLockSelectionColorAction->setCheckable( true );
|
||||
mLockSelectionColorAction->setIcon( iconSelectLock );
|
||||
|
||||
QMenu *lockMenu = new QMenu( this );
|
||||
lockMenu->addAction( mLockColorAction );
|
||||
lockMenu->addAction( mLockSelectionColorAction );
|
||||
btnLock->setMenu( lockMenu );
|
||||
btnLock->setPopupMode( QToolButton::InstantPopup );
|
||||
|
||||
btnDuplicate->setIcon( QIcon( QgsApplication::iconPath( "mActionDuplicateLayer.svg" ) ) );
|
||||
btnUp->setIcon( QIcon( QgsApplication::iconPath( "mActionArrowUp.svg" ) ) );
|
||||
btnDown->setIcon( QIcon( QgsApplication::iconPath( "mActionArrowDown.svg" ) ) );
|
||||
@ -311,10 +339,24 @@ QgsSymbolSelectorWidget::QgsSymbolSelectorWidget( QgsSymbol *symbol, QgsStyle *s
|
||||
connect( btnDown, &QAbstractButton::clicked, this, &QgsSymbolSelectorWidget::moveLayerDown );
|
||||
connect( btnAddLayer, &QAbstractButton::clicked, this, &QgsSymbolSelectorWidget::addLayer );
|
||||
connect( btnRemoveLayer, &QAbstractButton::clicked, this, &QgsSymbolSelectorWidget::removeLayer );
|
||||
connect( btnLock, &QAbstractButton::clicked, this, &QgsSymbolSelectorWidget::lockLayer );
|
||||
connect( mLockColorAction, &QAction::toggled, this, &QgsSymbolSelectorWidget::lockLayer );
|
||||
connect( mLockSelectionColorAction, &QAction::toggled, this, [ = ]( bool checked )
|
||||
{
|
||||
QgsSymbolLayer *layer = currentLayer();
|
||||
if ( !layer )
|
||||
return;
|
||||
|
||||
Qgis::SymbolLayerUserFlags flags = layer->userFlags();
|
||||
flags.setFlag( Qgis::SymbolLayerUserFlag::DisableSelectionRecoloring, checked );
|
||||
layer->setUserFlags( flags );
|
||||
updateLockButtonIcon();
|
||||
emit symbolModified();
|
||||
} );
|
||||
connect( btnDuplicate, &QAbstractButton::clicked, this, &QgsSymbolSelectorWidget::duplicateLayer );
|
||||
connect( this, &QgsSymbolSelectorWidget::symbolModified, this, &QgsPanelWidget::widgetChanged );
|
||||
|
||||
updateLockButtonIcon();
|
||||
|
||||
updateUi();
|
||||
|
||||
// set symbol as active item in the tree
|
||||
@ -587,7 +629,22 @@ void QgsSymbolSelectorWidget::updateLockButton()
|
||||
QgsSymbolLayer *layer = currentLayer();
|
||||
if ( !layer )
|
||||
return;
|
||||
btnLock->setChecked( layer->isLocked() );
|
||||
mLockColorAction->setChecked( layer->isLocked() );
|
||||
mLockSelectionColorAction->setChecked( layer->userFlags() & Qgis::SymbolLayerUserFlag::DisableSelectionRecoloring );
|
||||
|
||||
updateLockButtonIcon();
|
||||
}
|
||||
|
||||
void QgsSymbolSelectorWidget::updateLockButtonIcon()
|
||||
{
|
||||
if ( mLockColorAction->isChecked() && mLockSelectionColorAction->isChecked() )
|
||||
btnLock->setIcon( QgsApplication::getThemeIcon( QStringLiteral( "locked.svg" ) ) );
|
||||
else if ( mLockColorAction->isChecked() )
|
||||
btnLock->setIcon( QgsApplication::getThemeIcon( QStringLiteral( "mIconColorLocked.svg" ) ) );
|
||||
else if ( mLockSelectionColorAction->isChecked() )
|
||||
btnLock->setIcon( QgsApplication::getThemeIcon( QStringLiteral( "mIconSelectLocked.svg" ) ) );
|
||||
else
|
||||
btnLock->setIcon( QgsApplication::getThemeIcon( QStringLiteral( "unlocked.svg" ) ) );
|
||||
}
|
||||
|
||||
void QgsSymbolSelectorWidget::addLayer()
|
||||
@ -703,7 +760,8 @@ void QgsSymbolSelectorWidget::lockLayer()
|
||||
QgsSymbolLayer *layer = currentLayer();
|
||||
if ( !layer )
|
||||
return;
|
||||
layer->setLocked( btnLock->isChecked() );
|
||||
layer->setLocked( mLockColorAction->isChecked() );
|
||||
updateLockButtonIcon();
|
||||
emit symbolModified();
|
||||
}
|
||||
|
||||
|
@ -234,6 +234,8 @@ class GUI_EXPORT QgsSymbolSelectorWidget: public QgsPanelWidget, private Ui::Qgs
|
||||
*/
|
||||
void updateLockButton();
|
||||
|
||||
void updateLockButtonIcon();
|
||||
|
||||
SymbolLayerItem *currentLayerItem();
|
||||
|
||||
/**
|
||||
@ -257,6 +259,8 @@ class GUI_EXPORT QgsSymbolSelectorWidget: public QgsPanelWidget, private Ui::Qgs
|
||||
QgsStyle *mStyle = nullptr;
|
||||
QgsSymbol *mSymbol = nullptr;
|
||||
QMenu *mAdvancedMenu = nullptr;
|
||||
QAction *mLockColorAction = nullptr;
|
||||
QAction *mLockSelectionColorAction = nullptr;
|
||||
QPointer< QgsVectorLayer > mVectorLayer;
|
||||
|
||||
QStandardItemModel *mSymbolLayersModel = nullptr;
|
||||
|
@ -75,7 +75,7 @@
|
||||
<number>4</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QPushButton" name="btnAddLayer">
|
||||
<widget class="QToolButton" name="btnAddLayer">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>50</width>
|
||||
@ -85,10 +85,13 @@
|
||||
<property name="toolTip">
|
||||
<string>Add symbol layer</string>
|
||||
</property>
|
||||
<property name="autoRaise">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="btnRemoveLayer">
|
||||
<widget class="QToolButton" name="btnRemoveLayer">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>50</width>
|
||||
@ -98,10 +101,13 @@
|
||||
<property name="toolTip">
|
||||
<string>Remove symbol layer</string>
|
||||
</property>
|
||||
<property name="autoRaise">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="btnDuplicate">
|
||||
<widget class="QToolButton" name="btnDuplicate">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>50</width>
|
||||
@ -114,6 +120,9 @@
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="autoRaise">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
@ -121,15 +130,15 @@
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Preferred</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>10</width>
|
||||
<height>50</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Preferred</enum>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
@ -140,7 +149,7 @@
|
||||
<number>4</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QPushButton" name="btnUp">
|
||||
<widget class="QToolButton" name="btnUp">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>50</width>
|
||||
@ -150,10 +159,13 @@
|
||||
<property name="toolTip">
|
||||
<string>Move up</string>
|
||||
</property>
|
||||
<property name="autoRaise">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="btnDown">
|
||||
<widget class="QToolButton" name="btnDown">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>50</width>
|
||||
@ -163,10 +175,13 @@
|
||||
<property name="toolTip">
|
||||
<string>Move down</string>
|
||||
</property>
|
||||
<property name="autoRaise">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="btnLock">
|
||||
<widget class="QToolButton" name="btnLock">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>50</width>
|
||||
@ -179,6 +194,9 @@
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="autoRaise">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
@ -186,15 +204,15 @@
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Preferred</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>10</width>
|
||||
<height>50</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Preferred</enum>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
@ -254,8 +272,8 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>332</width>
|
||||
<height>413</height>
|
||||
<width>338</width>
|
||||
<height>442</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
|
Loading…
x
Reference in New Issue
Block a user