Skip to content

Commit

Permalink
Add a new widget QgsImageSourceLineEdit, based on QgsSvgSourceLineEdit
Browse files Browse the repository at this point in the history
Allows images to be set to base64 embedded images, remote urls, etc
when used alongside QgsImageCache
  • Loading branch information
nyalldawson committed Dec 5, 2018
1 parent cce5c4e commit 9d28a96
Show file tree
Hide file tree
Showing 12 changed files with 460 additions and 47 deletions.
@@ -1,35 +1,39 @@
/************************************************************************
* This file has been generated automatically from *
* *
* src/gui/qgssvgsourcelineedit.h *
* src/gui/qgsfilecontentsourcelineedit.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/




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

.. versionadded:: 3.4
This class is designed to be used by content which is managed by a QgsAbstractContentCache,
i.e. it can handle either direct file paths, base64 encoded contents, or remote HTTP
urls.

.. versionadded:: 3.6
%End

%TypeHeaderCode
#include "qgssvgsourcelineedit.h"
#include "qgsfilecontentsourcelineedit.h"
%End
public:

QgsSvgSourceLineEdit( QWidget *parent /TransferThis/ = 0 );
QgsAbstractFileContentSourceLineEdit( QWidget *parent /TransferThis/ = 0 );
%Docstring
Constructor for QgsSvgSourceLineEdit, with the specified ``parent`` widget.
Constructor for QgsAbstractFileContentSourceLineEdit, with the specified ``parent`` widget.
%End

QString source() const;
%Docstring
Returns the current SVG source.
Returns the current file source.

.. seealso:: :py:func:`setSource`

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

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

void sourceChanged( const QString &source );
%Docstring
Emitted whenever the SVG source is changed in the widget.
Emitted whenever the file source is changed in the widget.
%End

};

class QgsSvgSourceLineEdit : QgsAbstractFileContentSourceLineEdit
{
%Docstring
A line edit widget with toolbutton for setting an SVG image path.

Designed for use with :py:class:`QgsSvgCache`.

.. seealso:: :py:class:`QgsImageSourceLineEdit`

.. versionadded:: 3.4
%End

%TypeHeaderCode
#include "qgsfilecontentsourcelineedit.h"
%End
public:

QgsSvgSourceLineEdit( QWidget *parent /TransferThis/ = 0 );
%Docstring
Constructor for QgsSvgSourceLineEdit, with the specified ``parent`` widget.
%End

};


class QgsImageSourceLineEdit : QgsAbstractFileContentSourceLineEdit
{
%Docstring
A line edit widget with toolbutton for setting a raster image path.

Designed for use with :py:class:`QgsImageCache`.

.. seealso:: :py:class:`QgsSvgSourceLineEdit`

.. versionadded:: 3.6
%End

%TypeHeaderCode
#include "qgsfilecontentsourcelineedit.h"
%End
public:

QgsImageSourceLineEdit( QWidget *parent /TransferThis/ = 0 );
%Docstring
Constructor for QgsImageSourceLineEdit, with the specified ``parent`` widget.
%End

};

/************************************************************************
* This file has been generated automatically from *
* *
* src/gui/qgssvgsourcelineedit.h *
* src/gui/qgsfilecontentsourcelineedit.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/
2 changes: 1 addition & 1 deletion python/gui/gui_auto.sip
Expand Up @@ -116,6 +116,7 @@
%Include auto_generated/qgsfeaturelistcombobox.sip
%Include auto_generated/qgsfieldvalidator.sip
%Include auto_generated/qgsfieldvalueslineedit.sip
%Include auto_generated/qgsfilecontentsourcelineedit.sip
%Include auto_generated/qgsfilewidget.sip
%Include auto_generated/qgsfilterlineedit.sip
%Include auto_generated/qgsfloatingwidget.sip
Expand Down Expand Up @@ -203,7 +204,6 @@
%Include auto_generated/qgsstatusbar.sip
%Include auto_generated/qgssublayersdialog.sip
%Include auto_generated/qgssubstitutionlistwidget.sip
%Include auto_generated/qgssvgsourcelineedit.sip
%Include auto_generated/qgssymbolbutton.sip
%Include auto_generated/qgstablewidgetbase.sip
%Include auto_generated/qgstabwidget.sip
Expand Down
4 changes: 2 additions & 2 deletions src/gui/CMakeLists.txt
Expand Up @@ -270,6 +270,7 @@ SET(QGIS_GUI_SRCS
qgsfeaturelistcombobox.cpp
qgsfieldvalidator.cpp
qgsfieldvalueslineedit.cpp
qgsfilecontentsourcelineedit.cpp
qgsfilewidget.cpp
qgsfilterlineedit.cpp
qgsfloatingwidget.cpp
Expand Down Expand Up @@ -369,7 +370,6 @@ SET(QGIS_GUI_SRCS
qgssubstitutionlistwidget.cpp
qgssqlcomposerdialog.cpp
qgsstatusbar.cpp
qgssvgsourcelineedit.cpp
qgssymbolbutton.cpp
qgstablewidgetbase.cpp
qgstabwidget.cpp
Expand Down Expand Up @@ -450,6 +450,7 @@ SET(QGIS_GUI_MOC_HDRS
qgsfeaturelistcombobox.h
qgsfieldvalidator.h
qgsfieldvalueslineedit.h
qgsfilecontentsourcelineedit.h
qgsfilewidget.h
qgsfilterlineedit.h
qgsfloatingwidget.h
Expand Down Expand Up @@ -542,7 +543,6 @@ SET(QGIS_GUI_MOC_HDRS
qgsstatusbar.h
qgssublayersdialog.h
qgssubstitutionlistwidget.h
qgssvgsourcelineedit.h
qgssymbolbutton.h
qgstablewidgetbase.h
qgstabwidget.h
Expand Down

0 comments on commit 9d28a96

Please sign in to comment.