QGIS API Documentation 3.99.0-Master (26c88405ac0)
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:
47
51 QgsAbstractFileContentSourceLineEdit( QWidget *parent SIP_TRANSFERTHIS = nullptr );
52
58 void setMessageBar( QgsMessageBar *bar );
59
65
71 QString source() const;
72
77 void setLastPathSettingsKey( const QString &key );
78
83 QgsPropertyOverrideButton *propertyOverrideToolButton() const { return mPropertyOverrideButton; }
84
89 void setPropertyOverrideToolButtonVisible( bool visible );
90
91 public slots:
92
98 void setSource( const QString &source );
99
100 signals:
101
105 void sourceChanged( const QString &source );
106
107 private:
108#ifndef SIP_RUN
110
114 virtual QString fileFilter() const = 0; // cppcheck-suppress pureVirtualCall
115
119 virtual QString selectFileTitle() const = 0; // cppcheck-suppress pureVirtualCall
120
124 virtual QString fileFromUrlTitle() const = 0; // cppcheck-suppress pureVirtualCall
125
129 virtual QString fileFromUrlText() const = 0; // cppcheck-suppress pureVirtualCall
130
134 virtual QString embedFileTitle() const = 0; // cppcheck-suppress pureVirtualCall
135
139 virtual QString extractFileTitle() const = 0; // cppcheck-suppress pureVirtualCall
140
144 virtual QString defaultSettingsKey() const = 0; // cppcheck-suppress pureVirtualCall
145
147#endif
148
149 private slots:
150 void selectFile();
151 void selectUrl();
152 void embedFile();
153 void extractFile();
154 void mFileLineEdit_textEdited( const QString &text );
155
156 private:
157 enum Mode
158 {
159 ModeFile,
160 ModeBase64,
161 };
162
163 Mode mMode = ModeFile;
164 bool mPropertyOverrideButtonVisible = false;
165
166 QgsFilterLineEdit *mFileLineEdit = nullptr;
167 QToolButton *mFileToolButton = nullptr;
168 QgsPropertyOverrideButton *mPropertyOverrideButton = nullptr;
169 QString mLastPathKey;
170 QString mBase64;
171 QgsMessageBar *mMessageBar = nullptr;
172
173 QString defaultPath() const;
174 QString settingsKey() const;
175};
176
177
188{
189 Q_OBJECT
190 public:
191
201
208 {}
209
211 void setMode( Format format ) { mFormat = format; }
212
213 protected:
214
218 QgsPictureSourceLineEditBase( Format format, QWidget *parent SIP_TRANSFERTHIS = nullptr )
220 , mFormat( format )
221 {}
222
223 private:
224 Format mFormat = Svg;
225
226#ifndef SIP_RUN
228 QString fileFilter() const override;
229 QString selectFileTitle() const override;
230 QString fileFromUrlTitle() const override;
231 QString fileFromUrlText() const override;
232 QString embedFileTitle() const override;
233 QString extractFileTitle() const override;
234 QString defaultSettingsKey() const override;
236#endif
237};
238
239
252{
253 Q_OBJECT
254 public:
255
259 QgsSvgSourceLineEdit( QWidget *parent SIP_TRANSFERTHIS = nullptr )
261 {}
262};
263
276{
277 Q_OBJECT
278 public:
279
283 QgsImageSourceLineEdit( QWidget *parent SIP_TRANSFERTHIS = nullptr )
285 {}
286};
287
288
301{
302 Q_OBJECT
303 public:
304
311};
312
313#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