Skip to content

Commit 084c455

Browse files
committedJun 14, 2015
Make size assistant more prominent in dd buttons, allow control of
assistant menu text
1 parent e2e6a13 commit 084c455

File tree

6 files changed

+15
-8
lines changed

6 files changed

+15
-8
lines changed
 

‎python/gui/qgsdatadefinedbutton.sip

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,11 +171,12 @@ class QgsDataDefinedButton : QToolButton
171171
/**
172172
* Sets an assistant used to define the data defined object properties.
173173
* Ownership of the assistant is transferred to the widget.
174+
* @param title menu title for the assistant
174175
* @param assistant data defined assistant. Set to null to remove the assistant
175176
* option from the button.
176177
* @note added in 2.10
177178
*/
178-
void setAssistant( QgsDataDefinedAssistant * assistant /Transfer/ );
179+
void setAssistant( const QString& title, QgsDataDefinedAssistant * assistant /Transfer/ );
179180

180181
/**
181182
* Common descriptions for expected input values

‎src/gui/qgsdatadefinedbutton.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,10 @@ QgsDataDefinedButton::QgsDataDefinedButton( QWidget* parent,
8585
mActionCopyExpr = new QAction( tr( "Copy" ), this );
8686
mActionClearExpr = new QAction( tr( "Clear" ), this );
8787
mActionAssistant = new QAction( tr( "Assistant..." ), this );
88+
QFont assistantFont = mActionAssistant->font();
89+
assistantFont.setBold( true );
90+
mActionAssistant->setFont( assistantFont );
91+
mDefineMenu->addAction( mActionAssistant );
8892

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

631-
void QgsDataDefinedButton::setAssistant( QgsDataDefinedAssistant *assistant )
635+
void QgsDataDefinedButton::setAssistant( const QString& title, QgsDataDefinedAssistant *assistant )
632636
{
637+
mActionAssistant->setText( title.isEmpty() ? tr( "Assistant..." ) : title );
633638
mAssistant.reset( assistant );
634639
mAssistant.data()->setParent( this, Qt::Dialog );
635640
}

‎src/gui/qgsdatadefinedbutton.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -197,11 +197,12 @@ class GUI_EXPORT QgsDataDefinedButton: public QToolButton
197197
/**
198198
* Sets an assistant used to define the data defined object properties.
199199
* Ownership of the assistant is transferred to the widget.
200+
* @param title menu title for the assistant
200201
* @param assistant data defined assistant. Set to null to remove the assistant
201202
* option from the button.
202203
* @note added in 2.10
203204
*/
204-
void setAssistant( QgsDataDefinedAssistant * assistant );
205+
void setAssistant( const QString& title, QgsDataDefinedAssistant * assistant );
205206

206207
/**
207208
* Common descriptions for expected input values

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ class GUI_EXPORT QgsDataDefinedSizeDialog : public QgsDataDefinedValueDialog
174174
{
175175
init( tr( "Symbol size" ) );
176176
if ( symbolList.length() )
177-
mDDBtn->setAssistant( new QgsSizeScaleWidget( mLayer, static_cast<const QgsMarkerSymbolV2*>( symbolList[0] ) ) );
177+
mDDBtn->setAssistant( tr( "Size Assistant..." ), new QgsSizeScaleWidget( mLayer, static_cast<const QgsMarkerSymbolV2*>( symbolList[0] ) ) );
178178
}
179179

180180
protected:

‎src/gui/symbology-ng/qgssymbollayerv2widget.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -338,7 +338,7 @@ QgsSimpleMarkerSymbolLayerV2Widget::QgsSimpleMarkerSymbolLayerV2Widget( const Qg
338338
//make a temporary symbol for the size assistant preview
339339
mAssistantPreviewSymbol = new QgsMarkerSymbolV2();
340340

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

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

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

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

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

25092509
connect( cboFont, SIGNAL( currentFontChanged( const QFont & ) ), this, SLOT( setFontFamily( const QFont& ) ) );
25102510
connect( spinSize, SIGNAL( valueChanged( double ) ), this, SLOT( setSize( double ) ) );

‎src/gui/symbology-ng/qgssymbolslistwidget.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ QgsSymbolsListWidget::QgsSymbolsListWidget( QgsSymbolV2* symbol, QgsStyleV2* sty
107107
connect( mWidthDDBtn, SIGNAL( dataDefinedActivated( bool ) ), this, SLOT( updateDataDefinedLineWidth() ) );
108108

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

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

0 commit comments

Comments
 (0)
Please sign in to comment.