Skip to content

Commit 9d28a96

Browse files
committedDec 5, 2018
Add a new widget QgsImageSourceLineEdit, based on QgsSvgSourceLineEdit
Allows images to be set to base64 embedded images, remote urls, etc when used alongside QgsImageCache
1 parent cce5c4e commit 9d28a96

12 files changed

+460
-47
lines changed
 

‎python/gui/auto_generated/qgssvgsourcelineedit.sip.in renamed to ‎python/gui/auto_generated/qgsfilecontentsourcelineedit.sip.in

Lines changed: 64 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,39 @@
11
/************************************************************************
22
* This file has been generated automatically from *
33
* *
4-
* src/gui/qgssvgsourcelineedit.h *
4+
* src/gui/qgsfilecontentsourcelineedit.h *
55
* *
66
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
77
************************************************************************/
88

99

1010

1111

12-
class QgsSvgSourceLineEdit : QWidget
12+
class QgsAbstractFileContentSourceLineEdit : QWidget /Abstract/
1313
{
1414
%Docstring
15-
A line edit widget with toolbutton for setting an SVG image path.
15+
Abstract base class for a widgets which allows users to select content from a file, embedding a file, etc.
1616

17-
.. versionadded:: 3.4
17+
This class is designed to be used by content which is managed by a QgsAbstractContentCache,
18+
i.e. it can handle either direct file paths, base64 encoded contents, or remote HTTP
19+
urls.
20+
21+
.. versionadded:: 3.6
1822
%End
1923

2024
%TypeHeaderCode
21-
#include "qgssvgsourcelineedit.h"
25+
#include "qgsfilecontentsourcelineedit.h"
2226
%End
2327
public:
2428

25-
QgsSvgSourceLineEdit( QWidget *parent /TransferThis/ = 0 );
29+
QgsAbstractFileContentSourceLineEdit( QWidget *parent /TransferThis/ = 0 );
2630
%Docstring
27-
Constructor for QgsSvgSourceLineEdit, with the specified ``parent`` widget.
31+
Constructor for QgsAbstractFileContentSourceLineEdit, with the specified ``parent`` widget.
2832
%End
2933

3034
QString source() const;
3135
%Docstring
32-
Returns the current SVG source.
36+
Returns the current file source.
3337

3438
.. seealso:: :py:func:`setSource`
3539

@@ -39,7 +43,7 @@ Returns the current SVG source.
3943
void setLastPathSettingsKey( const QString &key );
4044
%Docstring
4145
Sets a specific settings ``key`` to use when storing the last
42-
used path for the SVG source.
46+
used path for the file source.
4347
%End
4448

4549
public slots:
@@ -57,15 +61,64 @@ Sets a new ``source`` to show in the widget.
5761

5862
void sourceChanged( const QString &source );
5963
%Docstring
60-
Emitted whenever the SVG source is changed in the widget.
64+
Emitted whenever the file source is changed in the widget.
65+
%End
66+
67+
};
68+
69+
class QgsSvgSourceLineEdit : QgsAbstractFileContentSourceLineEdit
70+
{
71+
%Docstring
72+
A line edit widget with toolbutton for setting an SVG image path.
73+
74+
Designed for use with :py:class:`QgsSvgCache`.
75+
76+
.. seealso:: :py:class:`QgsImageSourceLineEdit`
77+
78+
.. versionadded:: 3.4
79+
%End
80+
81+
%TypeHeaderCode
82+
#include "qgsfilecontentsourcelineedit.h"
83+
%End
84+
public:
85+
86+
QgsSvgSourceLineEdit( QWidget *parent /TransferThis/ = 0 );
87+
%Docstring
88+
Constructor for QgsSvgSourceLineEdit, with the specified ``parent`` widget.
89+
%End
90+
91+
};
92+
93+
94+
class QgsImageSourceLineEdit : QgsAbstractFileContentSourceLineEdit
95+
{
96+
%Docstring
97+
A line edit widget with toolbutton for setting a raster image path.
98+
99+
Designed for use with :py:class:`QgsImageCache`.
100+
101+
.. seealso:: :py:class:`QgsSvgSourceLineEdit`
102+
103+
.. versionadded:: 3.6
104+
%End
105+
106+
%TypeHeaderCode
107+
#include "qgsfilecontentsourcelineedit.h"
108+
%End
109+
public:
110+
111+
QgsImageSourceLineEdit( QWidget *parent /TransferThis/ = 0 );
112+
%Docstring
113+
Constructor for QgsImageSourceLineEdit, with the specified ``parent`` widget.
61114
%End
62115

63116
};
64117

65118
/************************************************************************
66119
* This file has been generated automatically from *
67120
* *
68-
* src/gui/qgssvgsourcelineedit.h *
121+
* src/gui/qgsfilecontentsourcelineedit.h *
69122
* *
70123
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
71124
************************************************************************/

‎python/gui/gui_auto.sip

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,7 @@
116116
%Include auto_generated/qgsfeaturelistcombobox.sip
117117
%Include auto_generated/qgsfieldvalidator.sip
118118
%Include auto_generated/qgsfieldvalueslineedit.sip
119+
%Include auto_generated/qgsfilecontentsourcelineedit.sip
119120
%Include auto_generated/qgsfilewidget.sip
120121
%Include auto_generated/qgsfilterlineedit.sip
121122
%Include auto_generated/qgsfloatingwidget.sip
@@ -203,7 +204,6 @@
203204
%Include auto_generated/qgsstatusbar.sip
204205
%Include auto_generated/qgssublayersdialog.sip
205206
%Include auto_generated/qgssubstitutionlistwidget.sip
206-
%Include auto_generated/qgssvgsourcelineedit.sip
207207
%Include auto_generated/qgssymbolbutton.sip
208208
%Include auto_generated/qgstablewidgetbase.sip
209209
%Include auto_generated/qgstabwidget.sip

‎src/gui/CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -270,6 +270,7 @@ SET(QGIS_GUI_SRCS
270270
qgsfeaturelistcombobox.cpp
271271
qgsfieldvalidator.cpp
272272
qgsfieldvalueslineedit.cpp
273+
qgsfilecontentsourcelineedit.cpp
273274
qgsfilewidget.cpp
274275
qgsfilterlineedit.cpp
275276
qgsfloatingwidget.cpp
@@ -369,7 +370,6 @@ SET(QGIS_GUI_SRCS
369370
qgssubstitutionlistwidget.cpp
370371
qgssqlcomposerdialog.cpp
371372
qgsstatusbar.cpp
372-
qgssvgsourcelineedit.cpp
373373
qgssymbolbutton.cpp
374374
qgstablewidgetbase.cpp
375375
qgstabwidget.cpp
@@ -450,6 +450,7 @@ SET(QGIS_GUI_MOC_HDRS
450450
qgsfeaturelistcombobox.h
451451
qgsfieldvalidator.h
452452
qgsfieldvalueslineedit.h
453+
qgsfilecontentsourcelineedit.h
453454
qgsfilewidget.h
454455
qgsfilterlineedit.h
455456
qgsfloatingwidget.h
@@ -542,7 +543,6 @@ SET(QGIS_GUI_MOC_HDRS
542543
qgsstatusbar.h
543544
qgssublayersdialog.h
544545
qgssubstitutionlistwidget.h
545-
qgssvgsourcelineedit.h
546546
qgssymbolbutton.h
547547
qgstablewidgetbase.h
548548
qgstabwidget.h

0 commit comments

Comments
 (0)
Please sign in to comment.