QGIS API Documentation  3.22.4-Białowieża (ce8e65e95e)
qgsfilesourcelineedit.h
Go to the documentation of this file.
1 /***************************************************************************
2  qgssvgsourcelineedit.h
3  ---------------------
4  begin : July 2018
5  copyright : (C) 2018 by Nyall Dawson
6  email : nyall dot dawson at gmail dot com
7  ***************************************************************************
8  * *
9  * This program is free software; you can redistribute it and/or modify *
10  * it under the terms of the GNU General Public License as published by *
11  * the Free Software Foundation; either version 2 of the License, or *
12  * (at your option) any later version. *
13  * *
14  ***************************************************************************/
15 
16 #ifndef QGSSVGSOURCELINEEDIT_H
17 #define QGSSVGSOURCELINEEDIT_H
18 
19 #include "qgis_gui.h"
20 #include "qgis_sip.h"
21 #include <QWidget>
22 
23 class QLineEdit;
24 class QToolButton;
25 
32 class GUI_EXPORT QgsSvgSourceLineEdit : public QWidget
33 {
34  Q_OBJECT
35  Q_PROPERTY( QString source READ source WRITE setSource NOTIFY sourceChanged )
36 
37  public:
38 
42  QgsSvgSourceLineEdit( QWidget *parent SIP_TRANSFERTHIS = nullptr );
43 
49  QString source() const;
50 
55  void setLastPathSettingsKey( const QString &key );
56 
57  public slots:
58 
64  void setSource( const QString &source );
65 
66  signals:
67 
71  void sourceChanged( const QString &source );
72 
73  private slots:
74  void selectFile();
75  void selectUrl();
76  void embedFile();
77  void extractFile();
78  void mFileLineEdit_textEdited( const QString &text );
79  void mFileLineEdit_editingFinished();
80 
81  private:
82 
83  QLineEdit *mFileLineEdit = nullptr;
84  QToolButton *mFileToolButton = nullptr;
85  QString mLastPathKey;
86 
87  QString defaultPath() const;
88  QString settingsKey() const;
89 
90 };
91 
92 #endif
A line edit widget with toolbutton for setting an SVG image path.
void setSource(const QString &source)
Sets a new source to show in the widget.
void sourceChanged(const QString &source)
Emitted whenever the SVG source is changed in the widget.
QgsSvgSourceLineEdit(QWidget *parent=nullptr)
Constructor for QgsSvgSourceLineEdit, with the specified parent widget.
void setLastPathSettingsKey(const QString &key)
Sets a specific settings key to use when storing the last used path for the SVG source.
QString source() const
Returns the current SVG source.
#define SIP_TRANSFERTHIS
Definition: qgis_sip.h:53