Skip to content

Commit

Permalink
reuse existing SVG selector widget in QgsSvgMarkerSymbolLayerWidget
Browse files Browse the repository at this point in the history
  • Loading branch information
3nids committed Oct 16, 2020
1 parent 1763626 commit 29b76f4
Show file tree
Hide file tree
Showing 13 changed files with 177 additions and 479 deletions.
7 changes: 7 additions & 0 deletions python/gui/auto_generated/qgsfilecontentsourcelineedit.sip.in
Expand Up @@ -59,6 +59,13 @@ Returns the current file source.
%Docstring
Sets a specific settings ``key`` to use when storing the last
used path for the file source.
%End

QgsPropertyOverrideButton *fileToolButton() const;
%Docstring
Returns the file tool button

.. versionadded:: 3.16
%End

public slots:
Expand Down
Expand Up @@ -84,6 +84,13 @@ Constructor for QgsSvgSelectorWidget

QString currentSvgPath() const;

QgsSvgSourceLineEdit *sourceLineEdit() const;
%Docstring
Returns the source line edit

.. versionadded:: 3.16
%End

public slots:
void setSvgPath( const QString &svgPath );
%Docstring
Expand Down
2 changes: 0 additions & 2 deletions src/gui/CMakeLists.txt
Expand Up @@ -556,7 +556,6 @@ SET(QGIS_GUI_SRCS
qgsstyleitemslistwidget.cpp
qgssublayersdialog.cpp
qgssubstitutionlistwidget.cpp
qgssvgbrowserwidget.cpp
qgssqlcomposerdialog.cpp
qgsstatusbar.cpp
qgssymbolbutton.cpp
Expand Down Expand Up @@ -796,7 +795,6 @@ SET(QGIS_GUI_HDRS
qgsstyleitemslistwidget.h
qgssublayersdialog.h
qgssubstitutionlistwidget.h
qgssvgbrowserwidget.h
qgssymbolbutton.h
qgssymbollayerselectionwidget.h
qgstablewidgetbase.h
Expand Down
3 changes: 2 additions & 1 deletion src/gui/qgsfilecontentsourcelineedit.cpp
Expand Up @@ -17,6 +17,7 @@
#include "qgssettings.h"
#include "qgsmessagebar.h"
#include "qgsfilterlineedit.h"
#include "qgspropertyoverridebutton.h"
#include <QMenu>
#include <QLineEdit>
#include <QToolButton>
Expand All @@ -35,7 +36,7 @@ QgsAbstractFileContentSourceLineEdit::QgsAbstractFileContentSourceLineEdit( QWid
layout->setContentsMargins( 0, 0, 0, 0 );
mFileLineEdit = new QgsFilterLineEdit( this );
mFileLineEdit->setShowClearButton( true );
mFileToolButton = new QToolButton( this );
mFileToolButton = new QgsPropertyOverrideButton( this );
mFileToolButton->setText( QString( QChar( 0x2026 ) ) );
layout->addWidget( mFileLineEdit, 1 );
layout->addWidget( mFileToolButton );
Expand Down
14 changes: 8 additions & 6 deletions src/gui/qgsfilecontentsourcelineedit.h
Expand Up @@ -24,6 +24,7 @@
class QgsFilterLineEdit;
class QToolButton;
class QgsMessageBar;
class QgsPropertyOverrideButton;

/**
* \ingroup gui
Expand All @@ -36,13 +37,8 @@ class QgsMessageBar;
*
* \since QGIS 3.6
*/
#ifndef SIP_RUN
class GUI_EXPORT QgsAbstractFileContentSourceLineEdit : public QWidget
{
#else
class GUI_EXPORT QgsAbstractFileContentSourceLineEdit : public QWidget SIP_ABSTRACT
{
#endif
Q_OBJECT
Q_PROPERTY( QString source READ source WRITE setSource NOTIFY sourceChanged )

Expand Down Expand Up @@ -79,6 +75,12 @@ class GUI_EXPORT QgsAbstractFileContentSourceLineEdit : public QWidget SIP_ABSTR
*/
void setLastPathSettingsKey( const QString &key );

/**
* Returns the file tool button
* \since QGIS 3.16
*/
QgsPropertyOverrideButton *fileToolButton() const {return mFileToolButton;}

public slots:

/**
Expand Down Expand Up @@ -156,7 +158,7 @@ class GUI_EXPORT QgsAbstractFileContentSourceLineEdit : public QWidget SIP_ABSTR
Mode mMode = ModeFile;

QgsFilterLineEdit *mFileLineEdit = nullptr;
QToolButton *mFileToolButton = nullptr;
QgsPropertyOverrideButton *mFileToolButton = nullptr;
QString mLastPathKey;
QString mBase64;
QgsMessageBar *mMessageBar = nullptr;
Expand Down
138 changes: 0 additions & 138 deletions src/gui/qgssvgbrowserwidget.cpp

This file was deleted.

73 changes: 0 additions & 73 deletions src/gui/qgssvgbrowserwidget.h

This file was deleted.

6 changes: 6 additions & 0 deletions src/gui/symbology/qgssvgselectorwidget.h
Expand Up @@ -262,6 +262,12 @@ class GUI_EXPORT QgsSvgSelectorWidget : public QWidget, private Ui::WidgetSvgSel

QString currentSvgPath() const;

/**
* Returns the source line edit
* \since QGIS 3.16
*/
QgsSvgSourceLineEdit *sourceLineEdit() const {return mSvgSourceLineEdit;}

public slots:
//! Accepts absolute paths
void setSvgPath( const QString &svgPath );
Expand Down

0 comments on commit 29b76f4

Please sign in to comment.