17#ifndef QGSSVGSELECTORWIDGET_H
18#define QGSSVGSELECTORWIDGET_H
20#include "ui_widget_svgselector.h"
26#include <QSortFilterProxyModel>
27#include <QAbstractListModel>
29#include <QDialogButtonBox>
31#include <QStandardItemModel>
34#include <QElapsedTimer>
35#include <QItemDelegate>
60class GUI_EXPORT QgsSvgParametersModel :
public QAbstractTableModel
65 enum class Column :
int
71 QgsSvgParametersModel( QObject *parent =
nullptr );
74 void setParameters(
const QMap<QString, QgsProperty> ¶meters );
76 QMap<QString, QgsProperty> parameters()
const;
79 void removeParameters(
const QModelIndexList &indexList );
91 int rowCount(
const QModelIndex &parent )
const override;
92 int columnCount(
const QModelIndex &parent )
const override;
93 QVariant data(
const QModelIndex &index,
int role )
const override;
94 bool setData(
const QModelIndex &index,
const QVariant &value,
int role )
override;
95 QVariant headerData(
int section, Qt::Orientation orientation,
int role )
const override;
96 Qt::ItemFlags flags(
const QModelIndex &index )
const override;
104 void parametersChanged(
const QMap<QString, QgsProperty> ¶meters );
109 Parameter(
const QString &name,
const QgsProperty &property )
110 : name( name ), property( property ) {}
116 QList<Parameter> mParameters;
127class GUI_EXPORT QgsSvgParameterValueDelegate :
public QItemDelegate
132 QgsSvgParameterValueDelegate( QObject *parent =
nullptr )
133 : QItemDelegate( parent )
136 QWidget *createEditor( QWidget *parent,
const QStyleOptionViewItem &option,
const QModelIndex &index )
const override;
137 void setEditorData( QWidget *editor,
const QModelIndex &index )
const override;
138 void setModelData( QWidget *editor, QAbstractItemModel *model,
const QModelIndex &index )
const override;
139 void updateEditorGeometry( QWidget *editor,
const QStyleOptionViewItem &option,
const QModelIndex &index )
const override;
149class GUI_EXPORT QgsSvgSelectorLoader :
public QThread
159 QgsSvgSelectorLoader( QObject *parent =
nullptr );
161 ~QgsSvgSelectorLoader()
override;
180 void setPath(
const QString &path )
192 void foundSvgs( QStringList svgs );
197 bool mCanceled =
false;
198 QStringList mQueuedSvgs;
200 QElapsedTimer mTimer;
201 int mTimerThreshold = 0;
202 QSet< QString > mTraversedPaths;
204 void loadPath(
const QString &path );
205 void loadImages(
const QString &path );
214class GUI_EXPORT QgsSvgGroupLoader :
public QThread
224 QgsSvgGroupLoader( QObject *parent =
nullptr );
226 ~QgsSvgGroupLoader()
override;
244 void setParentPaths(
const QStringList &parentPaths )
246 mParentPaths = parentPaths;
256 void foundPath(
const QString &parentPath,
const QString &path );
260 QStringList mParentPaths;
261 bool mCanceled =
false;
262 QSet< QString > mTraversedPaths;
264 void loadGroup(
const QString &parentPath );
326 int rowCount(
const QModelIndex &parent = QModelIndex() )
const override;
327 QVariant data(
const QModelIndex &index,
int role = Qt::DisplayRole )
const override;
333 QPixmap createPreview(
const QString &entry )
const;
334 QgsSvgSelectorLoader *mSvgLoader =
nullptr;
344 void addSvgs(
const QStringList &svgs );
365 QgsSvgGroupLoader *mLoader =
nullptr;
366 QHash< QString, QStandardItem * > mPathItemHash;
370 void addPath(
const QString &parentPath,
const QString &path );
392 QString currentSvgPath()
const;
404 void setAllowParameters(
bool allow );
416 void setBrowserVisible(
bool visible );
432 void setSvgPath(
const QString &svgPath );
438 void setSvgParameters(
const QMap<QString, QgsProperty> ¶meters );
453 void populateIcons(
const QModelIndex &idx );
454 void svgSelectionChanged(
const QModelIndex &idx );
455 void updateCurrentSvgPath(
const QString &svgPath );
456 void svgSourceChanged(
const QString &text );
460 QString mCurrentSvgPath;
461 bool mAllowParameters =
false;
462 bool mBrowserVisible =
true;
463 QgsSvgParametersModel *mParametersModel =
nullptr;
479 Qt::WindowFlags fl = QgsGuiUtils::ModalDialogFlags,
480 QDialogButtonBox::StandardButtons buttons = QDialogButtonBox::Close | QDialogButtonBox::Ok,
481 Qt::Orientation orientation = Qt::Horizontal );
487 QVBoxLayout *mLayout =
nullptr;
488 QDialogButtonBox *mButtonBox =
nullptr;
Abstract interface for generating an expression context.
A line edit widget with toolbutton for setting a raster image path.
A store for object properties.
QgsSvgSelectorWidget * svgSelector()
Returns pointer to the embedded SVG selector widget.
A model for displaying SVG files with a preview icon which can be filtered by file name.
A model for displaying SVG search paths.
A model for displaying SVG files with a preview icon.
Represents a vector layer which manages a vector based data sets.