mirror of
https://github.com/qgis/QGIS.git
synced 2025-04-14 00:07:35 -04:00
Make size assistant more prominent in dd buttons, allow control of
assistant menu text
This commit is contained in:
parent
e2e6a1351f
commit
084c4558b6
@ -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 );
|
||||
|
Loading…
x
Reference in New Issue
Block a user