Skip to content

Commit 3371003

Browse files
committedFeb 14, 2017
Small tweaks to property override button behavior
1 parent 516bdfe commit 3371003

File tree

3 files changed

+11
-7
lines changed

3 files changed

+11
-7
lines changed
 

‎src/gui/qgspropertyassistantwidget.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ void QgsPropertyAssistantWidget::registerExpressionContextGenerator( QgsExpressi
8282

8383
void QgsPropertyAssistantWidget::updateProperty( QgsProperty& property )
8484
{
85-
property.setActive( true );
85+
property.setActive( !mExpressionWidget->currentText().isEmpty() );
8686
if ( mExpressionWidget->isExpression() )
8787
property.setExpressionString( mExpressionWidget->currentField() );
8888
else

‎src/gui/qgspropertyoverridebutton.cpp

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -449,18 +449,14 @@ void QgsPropertyOverrideButton::menuActionTriggered( QAction* action )
449449
mExpressionString = exprString;
450450
mProperty.setExpressionString( mExpressionString );
451451
mProperty.setTransformer( nullptr );
452-
setActivePrivate( mProperty.isActive() );
452+
setActivePrivate( true );
453453
updateGui();
454454
emit changed();
455455
}
456456
}
457457
else if ( action == mActionClearExpr )
458458
{
459-
// only deactivate if defined expression is being used
460-
if ( mProperty.isActive() && mProperty.propertyType() == QgsProperty::ExpressionBasedProperty )
461-
{
462-
setActivePrivate( false );
463-
}
459+
setActivePrivate( false );
464460
mProperty.setStaticValue( QVariant() );
465461
mProperty.setTransformer( nullptr );
466462
mExpressionString.clear();
@@ -528,6 +524,13 @@ void QgsPropertyOverrideButton::showExpressionDialog()
528524

529525
void QgsPropertyOverrideButton::showAssistant()
530526
{
527+
//first step - try to convert any existing expression to a transformer if one doesn't
528+
//already exist
529+
if ( !mProperty.transformer() )
530+
{
531+
( void )mProperty.convertToTransformer();
532+
}
533+
531534
QgsPanelWidget* panel = QgsPanelWidget::findParentPanel( this );
532535
if ( panel && panel->dockMode() )
533536
{

‎src/gui/symbology-ng/qgssizescalewidget.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
#include <QStandardItemModel>
2323
#include <QItemDelegate>
2424
#include "qgis_gui.h"
25+
#include "qgsproperty.h"
2526

2627
class QgsVectorLayer;
2728
class QgsSymbol;

0 commit comments

Comments
 (0)
Please sign in to comment.