QGIS API Documentation 3.99.0-Master (2fe06baccd8)
Loading...
Searching...
No Matches
qgsfilecontentsourcelineedit.h
Go to the documentation of this file.
1/***************************************************************************
2 qgsfilecontentsourcelineedit.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 QGSFILECONTENTSOURCELINEEDIT_H
17#define QGSFILECONTENTSOURCELINEEDIT_H
18
19#include "qgis_gui.h"
20#include "qgis_sip.h"
21
22#include <QString>
23#include <QWidget>
24
26class QToolButton;
27class QgsMessageBar;
29
41class GUI_EXPORT QgsAbstractFileContentSourceLineEdit : public QWidget SIP_ABSTRACT
42{
43 Q_OBJECT
44 Q_PROPERTY( QString source READ source WRITE setSource NOTIFY sourceChanged )
45
46 public:
50 QgsAbstractFileContentSourceLineEdit( QWidget *parent SIP_TRANSFERTHIS = nullptr );
51
57 void setMessageBar( QgsMessageBar *bar );
58
64
70 QString source() const;
71
76 void setLastPathSettingsKey( const QString &key );
77
82 QgsPropertyOverrideButton *propertyOverrideToolButton() const { return mPropertyOverrideButton; }
83
88 void setPropertyOverrideToolButtonVisible( bool visible );
89
90 public slots:
91
97 void setSource( const QString &source );
98
99 signals:
100
104 void sourceChanged( const QString &source );
105
106 private:
107#ifndef SIP_RUN
109
113 virtual QString fileFilter() const = 0; // cppcheck-suppress pureVirtualCall
114
118 virtual QString selectFileTitle() const = 0; // cppcheck-suppress pureVirtualCall
119
123 virtual QString fileFromUrlTitle() const = 0; // cppcheck-suppress pureVirtualCall
124
128 virtual QString fileFromUrlText() const = 0; // cppcheck-suppress pureVirtualCall
129
133 virtual QString embedFileTitle() const = 0; // cppcheck-suppress pureVirtualCall
134
138 virtual QString extractFileTitle() const = 0; // cppcheck-suppress pureVirtualCall
139
143 virtual QString defaultSettingsKey() const = 0; // cppcheck-suppress pureVirtualCall
144
146#endif
147
148 private slots:
149 void selectFile();
150 void selectUrl();
151 void embedFile();
152 void extractFile();
153 void mFileLineEdit_textEdited( const QString &text );
154
155 private:
156 enum Mode
157 {
158 ModeFile,
159 ModeBase64,
160 };
161
162 Mode mMode = ModeFile;
163 bool mPropertyOverrideButtonVisible = false;
164
165 QgsFilterLineEdit *mFileLineEdit = nullptr;
166 QToolButton *mFileToolButton = nullptr;
167 QgsPropertyOverrideButton *mPropertyOverrideButton = nullptr;
168 QString mLastPathKey;
169 QString mBase64;
170 QgsMessageBar *mMessageBar = nullptr;
171
172 QString defaultPath() const;
173 QString settingsKey() const;
174};
175
176
187{
188 Q_OBJECT
189 public:
199
206 {}
207
209 void setMode( Format format ) { mFormat = format; }
210
211 protected:
215 QgsPictureSourceLineEditBase( Format format, QWidget *parent SIP_TRANSFERTHIS = nullptr )
217 , mFormat( format )
218 {}
219
220 private:
221 Format mFormat = Svg;
222
223#ifndef SIP_RUN
225 QString fileFilter() const override;
226 QString selectFileTitle() const override;
227 QString fileFromUrlTitle() const override;
228 QString fileFromUrlText() const override;
229 QString embedFileTitle() const override;
230 QString extractFileTitle() const override;
231 QString defaultSettingsKey() const override;
233#endif
234};
235
236
249{
250 Q_OBJECT
251 public:
255 QgsSvgSourceLineEdit( QWidget *parent SIP_TRANSFERTHIS = nullptr )
257 {}
258};
259
272{
273 Q_OBJECT
274 public:
278 QgsImageSourceLineEdit( QWidget *parent SIP_TRANSFERTHIS = nullptr )
280 {}
281};
282
283
296{
297 Q_OBJECT
298 public:
305};
306
307#endif // QGSFILECONTENTSOURCELINEEDIT_H
void setLastPathSettingsKey(const QString &key)
Sets a specific settings key to use when storing the last used path for the file source.
void sourceChanged(const QString &source)
Emitted whenever the file source is changed in the widget.
void setMessageBar(QgsMessageBar *bar)
Sets the message bar associated with the widget.
QgsMessageBar * messageBar() const
Returns the message bar associated with the widget.
QgsPropertyOverrideButton * propertyOverrideToolButton() const
Returns the property override tool button.
void setSource(const QString &source)
Sets a new source to show in the widget.
QgsAbstractFileContentSourceLineEdit(QWidget *parent=nullptr)
Constructor for QgsAbstractFileContentSourceLineEdit, with the specified parent widget.
QgsAnimatedImageSourceLineEdit(QWidget *parent=nullptr)
Constructor for QgsAnimatedImageSourceLineEdit, with the specified parent widget.
QLineEdit subclass with built in support for clearing the widget's value and handling custom null val...
QgsImageSourceLineEdit(QWidget *parent=nullptr)
Constructor for QgsImageSourceLineEdit, with the specified parent widget.
A bar for displaying non-blocking messages to the user.
QgsPictureSourceLineEditBase(Format format, QWidget *parent=nullptr)
Constructor for QgsImageSourceLineEdit, with the specified parent widget.
void setMode(Format format)
Defines the mode of the source line edit.
QgsPictureSourceLineEditBase(QWidget *parent=nullptr)
Constructor for QgsImageSourceLineEdit, with the specified parent widget.
A button for controlling property overrides which may apply to a widget.
QgsSvgSourceLineEdit(QWidget *parent=nullptr)
Constructor for QgsSvgSourceLineEdit, with the specified parent widget.
#define SIP_TRANSFERTHIS
Definition qgis_sip.h:53
#define SIP_ABSTRACT
Definition qgis_sip.h:221