Skip to content

Commit

Permalink
Small tweaks to property override button behavior
Browse files Browse the repository at this point in the history
  • Loading branch information
nyalldawson committed Feb 14, 2017
1 parent 516bdfe commit 3371003
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/gui/qgspropertyassistantwidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ void QgsPropertyAssistantWidget::registerExpressionContextGenerator( QgsExpressi

void QgsPropertyAssistantWidget::updateProperty( QgsProperty& property )
{
property.setActive( true );
property.setActive( !mExpressionWidget->currentText().isEmpty() );
if ( mExpressionWidget->isExpression() )
property.setExpressionString( mExpressionWidget->currentField() );
else
Expand Down
15 changes: 9 additions & 6 deletions src/gui/qgspropertyoverridebutton.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -449,18 +449,14 @@ void QgsPropertyOverrideButton::menuActionTriggered( QAction* action )
mExpressionString = exprString;
mProperty.setExpressionString( mExpressionString );
mProperty.setTransformer( nullptr );
setActivePrivate( mProperty.isActive() );
setActivePrivate( true );
updateGui();
emit changed();
}
}
else if ( action == mActionClearExpr )
{
// only deactivate if defined expression is being used
if ( mProperty.isActive() && mProperty.propertyType() == QgsProperty::ExpressionBasedProperty )
{
setActivePrivate( false );
}
setActivePrivate( false );
mProperty.setStaticValue( QVariant() );
mProperty.setTransformer( nullptr );
mExpressionString.clear();
Expand Down Expand Up @@ -528,6 +524,13 @@ void QgsPropertyOverrideButton::showExpressionDialog()

void QgsPropertyOverrideButton::showAssistant()
{
//first step - try to convert any existing expression to a transformer if one doesn't
//already exist
if ( !mProperty.transformer() )
{
( void )mProperty.convertToTransformer();
}

QgsPanelWidget* panel = QgsPanelWidget::findParentPanel( this );
if ( panel && panel->dockMode() )
{
Expand Down
1 change: 1 addition & 0 deletions src/gui/symbology-ng/qgssizescalewidget.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
#include <QStandardItemModel>
#include <QItemDelegate>
#include "qgis_gui.h"
#include "qgsproperty.h"

class QgsVectorLayer;
class QgsSymbol;
Expand Down

0 comments on commit 3371003

Please sign in to comment.