17 #ifndef QGSSVGSELECTORWIDGET_H 18 #define QGSSVGSELECTORWIDGET_H 20 #include "ui_widget_svgselector.h" 24 #include <QAbstractListModel> 26 #include <QDialogButtonBox> 28 #include <QStandardItemModel> 31 #include <QElapsedTimer> 51 class GUI_EXPORT QgsSvgSelectorLoader :
public QThread
61 QgsSvgSelectorLoader( QObject *parent =
nullptr );
63 ~QgsSvgSelectorLoader()
override;
82 void setPath(
const QString &path )
94 void foundSvgs( QStringList svgs );
99 bool mCanceled =
false;
100 QStringList mQueuedSvgs;
102 QElapsedTimer mTimer;
103 int mTimerThreshold = 0;
104 QSet< QString > mTraversedPaths;
106 void loadPath(
const QString &path );
107 void loadImages(
const QString &path );
117 class GUI_EXPORT QgsSvgGroupLoader :
public QThread
127 QgsSvgGroupLoader( QObject *parent =
nullptr );
129 ~QgsSvgGroupLoader()
override;
147 void setParentPaths(
const QStringList &parentPaths )
149 mParentPaths = parentPaths;
159 void foundPath(
const QString &parentPath,
const QString &path );
163 QStringList mParentPaths;
164 bool mCanceled =
false;
165 QSet< QString > mTraversedPaths;
167 void loadGroup(
const QString &parentPath );
203 int rowCount(
const QModelIndex &parent = QModelIndex() )
const override;
204 QVariant data(
const QModelIndex &index,
int role = Qt::DisplayRole )
const override;
210 QPixmap createPreview(
const QString &entry )
const;
211 QgsSvgSelectorLoader *mSvgLoader =
nullptr;
221 void addSvgs(
const QStringList &svgs );
242 QgsSvgGroupLoader *mLoader =
nullptr;
243 QHash< QString, QStandardItem * > mPathItemHash;
247 void addPath(
const QString &parentPath,
const QString &path );
263 QString currentSvgPath()
const;
267 void setSvgPath(
const QString &svgPath );
270 void svgSelected(
const QString &path );
276 void populateIcons(
const QModelIndex &idx );
277 void svgSelectionChanged(
const QModelIndex &idx );
278 void updateCurrentSvgPath(
const QString &svgPath );
280 void mFilePushButton_clicked();
281 void updateLineEditFeedback(
bool ok,
const QString &tip = QString() );
282 void mFileLineEdit_textChanged(
const QString &text );
288 QString mCurrentSvgPath;
305 Qt::WindowFlags fl = QgsGuiUtils::ModalDialogFlags,
306 QDialogButtonBox::StandardButtons buttons = QDialogButtonBox::Close | QDialogButtonBox::Ok,
307 Qt::Orientation orientation = Qt::Horizontal );
314 QVBoxLayout *mLayout =
nullptr;
315 QDialogButtonBox *mButtonBox =
nullptr;
319 #endif // QGSSVGSELECTORWIDGET_H
A model for displaying SVG files with a preview icon.
A model for displaying SVG search paths.
QgsSvgSelectorWidget * svgSelector()
Returns pointer to the embedded SVG selector widget.