mirror of
https://github.com/qgis/QGIS.git
synced 2025-12-15 00:07:25 -05:00
fix buttons in SVG source line edit (#39519)
This commit is contained in:
parent
454a0951ab
commit
2d82ef91d3
@ -61,9 +61,16 @@ Sets a specific settings ``key`` to use when storing the last
|
||||
used path for the file source.
|
||||
%End
|
||||
|
||||
QgsPropertyOverrideButton *fileToolButton() const;
|
||||
QgsPropertyOverrideButton *propertyOverrideToolButton() const;
|
||||
%Docstring
|
||||
Returns the file tool button
|
||||
Returns the property override tool button
|
||||
|
||||
.. versionadded:: 3.16
|
||||
%End
|
||||
|
||||
void setPropertyOverrideToolButtonVisible( bool visible );
|
||||
%Docstring
|
||||
Sets the visibility of the property override tool button
|
||||
|
||||
.. versionadded:: 3.16
|
||||
%End
|
||||
|
||||
@ -36,10 +36,12 @@ QgsAbstractFileContentSourceLineEdit::QgsAbstractFileContentSourceLineEdit( QWid
|
||||
layout->setContentsMargins( 0, 0, 0, 0 );
|
||||
mFileLineEdit = new QgsFilterLineEdit( this );
|
||||
mFileLineEdit->setShowClearButton( true );
|
||||
mFileToolButton = new QgsPropertyOverrideButton( this );
|
||||
mFileToolButton = new QToolButton( this );
|
||||
mFileToolButton->setText( QString( QChar( 0x2026 ) ) );
|
||||
mPropertyOverrideButton = new QgsPropertyOverrideButton( this );
|
||||
layout->addWidget( mFileLineEdit, 1 );
|
||||
layout->addWidget( mFileToolButton );
|
||||
layout->addWidget( mPropertyOverrideButton );
|
||||
setLayout( layout );
|
||||
|
||||
QMenu *sourceMenu = new QMenu( mFileToolButton );
|
||||
@ -78,6 +80,8 @@ QgsAbstractFileContentSourceLineEdit::QgsAbstractFileContentSourceLineEdit( QWid
|
||||
emit sourceChanged( QString() );
|
||||
} );
|
||||
|
||||
mPropertyOverrideButton->setVisible( mPropertyOverrideButtonVisible );
|
||||
|
||||
}
|
||||
|
||||
QString QgsAbstractFileContentSourceLineEdit::source() const
|
||||
@ -99,6 +103,12 @@ void QgsAbstractFileContentSourceLineEdit::setLastPathSettingsKey( const QString
|
||||
mLastPathKey = key;
|
||||
}
|
||||
|
||||
void QgsAbstractFileContentSourceLineEdit::setPropertyOverrideToolButtonVisible( bool visible )
|
||||
{
|
||||
mPropertyOverrideButtonVisible = visible;
|
||||
mPropertyOverrideButton->setVisible( visible );
|
||||
}
|
||||
|
||||
void QgsAbstractFileContentSourceLineEdit::setSource( const QString &source )
|
||||
{
|
||||
const bool isBase64 = source.startsWith( QLatin1String( "base64:" ), Qt::CaseInsensitive );
|
||||
|
||||
@ -76,10 +76,16 @@ class GUI_EXPORT QgsAbstractFileContentSourceLineEdit : public QWidget SIP_ABSTR
|
||||
void setLastPathSettingsKey( const QString &key );
|
||||
|
||||
/**
|
||||
* Returns the file tool button
|
||||
* Returns the property override tool button
|
||||
* \since QGIS 3.16
|
||||
*/
|
||||
QgsPropertyOverrideButton *fileToolButton() const {return mFileToolButton;}
|
||||
QgsPropertyOverrideButton *propertyOverrideToolButton() const {return mPropertyOverrideButton;}
|
||||
|
||||
/**
|
||||
* Sets the visibility of the property override tool button
|
||||
* \since QGIS 3.16
|
||||
*/
|
||||
void setPropertyOverrideToolButtonVisible( bool visible );
|
||||
|
||||
public slots:
|
||||
|
||||
@ -156,9 +162,11 @@ class GUI_EXPORT QgsAbstractFileContentSourceLineEdit : public QWidget SIP_ABSTR
|
||||
};
|
||||
|
||||
Mode mMode = ModeFile;
|
||||
bool mPropertyOverrideButtonVisible = false;
|
||||
|
||||
QgsFilterLineEdit *mFileLineEdit = nullptr;
|
||||
QgsPropertyOverrideButton *mFileToolButton = nullptr;
|
||||
QToolButton *mFileToolButton = nullptr;
|
||||
QgsPropertyOverrideButton *mPropertyOverrideButton = nullptr;
|
||||
QString mLastPathKey;
|
||||
QString mBase64;
|
||||
QgsMessageBar *mMessageBar = nullptr;
|
||||
|
||||
@ -2314,6 +2314,7 @@ QgsSvgMarkerSymbolLayerWidget::QgsSvgMarkerSymbolLayerWidget( QgsVectorLayer *vl
|
||||
|
||||
setupUi( this );
|
||||
|
||||
mSvgSelectorWidget->sourceLineEdit()->setPropertyOverrideToolButtonVisible( true );
|
||||
mSvgSelectorWidget->sourceLineEdit()->setLastPathSettingsKey( QStringLiteral( "/UI/lastSVGMarkerDir" ) );
|
||||
|
||||
connect( mSvgSelectorWidget->sourceLineEdit(), &QgsSvgSourceLineEdit::sourceChanged, this, &QgsSvgMarkerSymbolLayerWidget::svgSourceChanged );
|
||||
@ -2518,7 +2519,7 @@ void QgsSvgMarkerSymbolLayerWidget::setSymbolLayer( QgsSymbolLayer *layer )
|
||||
registerDataDefinedButton( mHorizontalAnchorDDBtn, QgsSymbolLayer::PropertyHorizontalAnchor );
|
||||
registerDataDefinedButton( mVerticalAnchorDDBtn, QgsSymbolLayer::PropertyVerticalAnchor );
|
||||
|
||||
registerDataDefinedButton( mSvgSelectorWidget->sourceLineEdit()->fileToolButton(), QgsSymbolLayer::PropertyName );
|
||||
registerDataDefinedButton( mSvgSelectorWidget->sourceLineEdit()->propertyOverrideToolButton(), QgsSymbolLayer::PropertyName );
|
||||
|
||||
updateAssistantSymbol();
|
||||
}
|
||||
|
||||
@ -137,7 +137,7 @@
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>20</height>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="focusPolicy">
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user