Skip to content
Permalink
Browse files
Make size assistant more prominent in dd buttons, allow control of
assistant menu text
  • Loading branch information
nyalldawson committed Jun 14, 2015
1 parent e2e6a13 commit 084c4558b6ec787feab4248f933d58bb3d4a57ed
@@ -171,11 +171,12 @@ class QgsDataDefinedButton : QToolButton
/**
* Sets an assistant used to define the data defined object properties.
* Ownership of the assistant is transferred to the widget.
* @param title menu title for the assistant
* @param assistant data defined assistant. Set to null to remove the assistant
* option from the button.
* @note added in 2.10
*/
void setAssistant( QgsDataDefinedAssistant * assistant /Transfer/ );
void setAssistant( const QString& title, QgsDataDefinedAssistant * assistant /Transfer/ );

/**
* Common descriptions for expected input values
@@ -85,6 +85,10 @@ QgsDataDefinedButton::QgsDataDefinedButton( QWidget* parent,
mActionCopyExpr = new QAction( tr( "Copy" ), this );
mActionClearExpr = new QAction( tr( "Clear" ), this );
mActionAssistant = new QAction( tr( "Assistant..." ), this );
QFont assistantFont = mActionAssistant->font();
assistantFont.setBold( true );
mActionAssistant->setFont( assistantFont );
mDefineMenu->addAction( mActionAssistant );

// set up sibling widget connections
connect( this, SIGNAL( dataDefinedActivated( bool ) ), this, SLOT( disableEnabledWidgets( bool ) ) );
@@ -628,8 +632,9 @@ QList<QWidget*> QgsDataDefinedButton::registeredCheckedWidgets()
return wdgtList;
}

void QgsDataDefinedButton::setAssistant( QgsDataDefinedAssistant *assistant )
void QgsDataDefinedButton::setAssistant( const QString& title, QgsDataDefinedAssistant *assistant )
{
mActionAssistant->setText( title.isEmpty() ? tr( "Assistant..." ) : title );
mAssistant.reset( assistant );
mAssistant.data()->setParent( this, Qt::Dialog );
}
@@ -197,11 +197,12 @@ class GUI_EXPORT QgsDataDefinedButton: public QToolButton
/**
* Sets an assistant used to define the data defined object properties.
* Ownership of the assistant is transferred to the widget.
* @param title menu title for the assistant
* @param assistant data defined assistant. Set to null to remove the assistant
* option from the button.
* @note added in 2.10
*/
void setAssistant( QgsDataDefinedAssistant * assistant );
void setAssistant( const QString& title, QgsDataDefinedAssistant * assistant );

/**
* Common descriptions for expected input values
@@ -174,7 +174,7 @@ class GUI_EXPORT QgsDataDefinedSizeDialog : public QgsDataDefinedValueDialog
{
init( tr( "Symbol size" ) );
if ( symbolList.length() )
mDDBtn->setAssistant( new QgsSizeScaleWidget( mLayer, static_cast<const QgsMarkerSymbolV2*>( symbolList[0] ) ) );
mDDBtn->setAssistant( tr( "Size Assistant..." ), new QgsSizeScaleWidget( mLayer, static_cast<const QgsMarkerSymbolV2*>( symbolList[0] ) ) );
}

protected:
@@ -338,7 +338,7 @@ QgsSimpleMarkerSymbolLayerV2Widget::QgsSimpleMarkerSymbolLayerV2Widget( const Qg
//make a temporary symbol for the size assistant preview
mAssistantPreviewSymbol = new QgsMarkerSymbolV2();

mSizeDDBtn->setAssistant( new QgsSizeScaleWidget( mVectorLayer, mAssistantPreviewSymbol ) );
mSizeDDBtn->setAssistant( tr( "Size Assistant..." ), new QgsSizeScaleWidget( mVectorLayer, mAssistantPreviewSymbol ) );

QSize size = lstNames->iconSize();
QStringList names;
@@ -1538,7 +1538,7 @@ QgsSvgMarkerSymbolLayerV2Widget::QgsSvgMarkerSymbolLayerV2Widget( const QgsVecto

//make a temporary symbol for the size assistant preview
mAssistantPreviewSymbol = new QgsMarkerSymbolV2();
mSizeDDBtn->setAssistant( new QgsSizeScaleWidget( mVectorLayer, mAssistantPreviewSymbol ) );
mSizeDDBtn->setAssistant( tr( "Size Assistant..." ), new QgsSizeScaleWidget( mVectorLayer, mAssistantPreviewSymbol ) );
}

QgsSvgMarkerSymbolLayerV2Widget::~QgsSvgMarkerSymbolLayerV2Widget()
@@ -2504,7 +2504,7 @@ QgsFontMarkerSymbolLayerV2Widget::QgsFontMarkerSymbolLayerV2Widget( const QgsVec
//make a temporary symbol for the size assistant preview
mAssistantPreviewSymbol = new QgsMarkerSymbolV2();

mSizeDDBtn->setAssistant( new QgsSizeScaleWidget( mVectorLayer, mAssistantPreviewSymbol ) );
mSizeDDBtn->setAssistant( tr( "Size Assistant..." ), new QgsSizeScaleWidget( mVectorLayer, mAssistantPreviewSymbol ) );

connect( cboFont, SIGNAL( currentFontChanged( const QFont & ) ), this, SLOT( setFontFamily( const QFont& ) ) );
connect( spinSize, SIGNAL( valueChanged( double ) ), this, SLOT( setSize( double ) ) );
@@ -107,7 +107,7 @@ QgsSymbolsListWidget::QgsSymbolsListWidget( QgsSymbolV2* symbol, QgsStyleV2* sty
connect( mWidthDDBtn, SIGNAL( dataDefinedActivated( bool ) ), this, SLOT( updateDataDefinedLineWidth() ) );

if ( mSymbol->type() == QgsSymbolV2::Marker && mLayer )
mSizeDDBtn->setAssistant( new QgsSizeScaleWidget( mLayer, static_cast<const QgsMarkerSymbolV2*>( mSymbol ) ) );
mSizeDDBtn->setAssistant( tr( "Size Assistant..." ), new QgsSizeScaleWidget( mLayer, static_cast<const QgsMarkerSymbolV2*>( mSymbol ) ) );

// Live color updates are not undoable to child symbol layers
btnColor->setAcceptLiveUpdates( false );

0 comments on commit 084c455

Please sign in to comment.