[layouts] add icons for items and use those in the items panel
@ -434,6 +434,19 @@
|
|||||||
<file>themes/default/mIconWms.svg</file>
|
<file>themes/default/mIconWms.svg</file>
|
||||||
<file>themes/default/mIconZip.png</file>
|
<file>themes/default/mIconZip.png</file>
|
||||||
<file>themes/default/mIconZoom.svg</file>
|
<file>themes/default/mIconZoom.svg</file>
|
||||||
|
<file>themes/default/mLayoutItem.svg</file>
|
||||||
|
<file>themes/default/mLayoutItemShapeEllipse.svg</file>
|
||||||
|
<file>themes/default/mLayoutItemShapeRectangle.svg</file>
|
||||||
|
<file>themes/default/mLayoutItemShapeTriangle.svg</file>
|
||||||
|
<file>themes/default/mLayoutItemHtml.svg</file>
|
||||||
|
<file>themes/default/mLayoutItemPicture.svg</file>
|
||||||
|
<file>themes/default/mLayoutItemLabel.svg</file>
|
||||||
|
<file>themes/default/mLayoutItemLegend.svg</file>
|
||||||
|
<file>themes/default/mLayoutItemMap.svg</file>
|
||||||
|
<file>themes/default/mLayoutItemPolygon.svg</file>
|
||||||
|
<file>themes/default/mLayoutItemPolyline.svg</file>
|
||||||
|
<file>themes/default/mLayoutItemScaleBar.svg</file>
|
||||||
|
<file>themes/default/mLayoutItemTable.svg</file>
|
||||||
<file>themes/default/mMessageLog.svg</file>
|
<file>themes/default/mMessageLog.svg</file>
|
||||||
<file>themes/default/mMessageLogRead.svg</file>
|
<file>themes/default/mMessageLogRead.svg</file>
|
||||||
<file>themes/default/north_arrow.png</file>
|
<file>themes/default/north_arrow.png</file>
|
||||||
|
1
images/themes/default/mLayoutItem.svg
Normal file
@ -0,0 +1 @@
|
|||||||
|
<svg xmlns="http://www.w3.org/2000/svg" height="16" width="16"><path d="M2.5 2.5h11v11h-11z" fill="#f0f0f0" stroke="#9a9a9a"/></svg>
|
After Width: | Height: | Size: 133 B |
1
images/themes/default/mLayoutItemHtml.svg
Normal file
@ -0,0 +1 @@
|
|||||||
|
<svg xmlns="http://www.w3.org/2000/svg" height="16" width="16"><path d="M1.5 1.5h13v13h-13z" fill="#f0f0f0" stroke="#9a9a9a"/><path d="M3 12h9M3 9h7M3 6h10" fill="#b3b3b3" stroke="#b3b3b3" stroke-width="2"/><path d="M5.955 3.52L3.5 6l2.455 2.48m4.09 0L12.5 6l-2.455-2.48M7.182 8.48l1.636-4.96" fill="none" stroke="#f0f0f0" stroke-width="3" stroke-linecap="round" stroke-linejoin="round"/><path d="M5.955 3.52L3.5 6l2.455 2.48m4.09 0L12.5 6l-2.455-2.48M7.182 8.48l1.636-4.96" fill="none" stroke="#424242" stroke-linecap="round" stroke-linejoin="round"/></svg>
|
After Width: | Height: | Size: 559 B |
1
images/themes/default/mLayoutItemLabel.svg
Normal file
@ -0,0 +1 @@
|
|||||||
|
<svg xmlns="http://www.w3.org/2000/svg" height="16" width="16"><path d="M1.5 2.5h13v11h-13z" fill="#f0f0f0" stroke="#9a9a9a"/><path d="M8 11.5v-7M10.5 6V4.5h-5V6M7 11.5h2" fill="none" stroke="#424242"/></svg>
|
After Width: | Height: | Size: 209 B |
1
images/themes/default/mLayoutItemLegend.svg
Normal file
@ -0,0 +1 @@
|
|||||||
|
<svg xmlns="http://www.w3.org/2000/svg" height="16" width="16"><path d="M1.5 1.5h3v3h-3zM1.5 6.5h3v3h-3zM1.5 11.5h3v3h-3z" fill="#b3b3b3" stroke="#424242"/><path d="M6 13h4M6 8h9M6 3h6" fill="#b3b3b3" stroke="#b3b3b3" stroke-width="2"/></svg>
|
After Width: | Height: | Size: 243 B |
1
images/themes/default/mLayoutItemMap.svg
Normal file
@ -0,0 +1 @@
|
|||||||
|
<svg xmlns="http://www.w3.org/2000/svg" height="16" width="16"><linearGradient id="a" gradientUnits="userSpaceOnUse" x1="3.5" x2="11.5" y1="19.5" y2="19.5" gradientTransform="translate(0 -8)"><stop offset="0" stop-color="#b7b7b7"/><stop offset="1" stop-color="#e6e6e6"/></linearGradient><path d="M14.5 13.5H2.658c-.58 0-1.145-.824-1.158-1.45V2.5h13z" fill="url(#a)" fill-rule="evenodd" stroke="#9a9a9a"/><path d="M3.816 2.185c-.58-.58-1.737-.58-2.316 0v8.897c.579-.58 1.737-.58 2.316 0z" fill="#e6e6e6" fill-rule="evenodd" stroke="#9a9a9a"/></svg>
|
After Width: | Height: | Size: 548 B |
1
images/themes/default/mLayoutItemPicture.svg
Normal file
@ -0,0 +1 @@
|
|||||||
|
<svg xmlns="http://www.w3.org/2000/svg" height="16" width="16"><path d="M1.5 3.5h13v9h-13z" fill="#424242" stroke="#9a9a9a"/><path d="M2 8l3.263-2.077L14 9.385v2.769H2z" fill="#f0f0f0" fill-rule="evenodd"/></svg>
|
After Width: | Height: | Size: 213 B |
1
images/themes/default/mLayoutItemPolygon.svg
Normal file
@ -0,0 +1 @@
|
|||||||
|
<svg xmlns="http://www.w3.org/2000/svg" height="16" width="16"><ellipse cy="2.975" cx="2.974" rx="1.522" ry="1.523" fill="#b3b3b3" stroke="#424242" stroke-width=".295" stroke-linejoin="round" stroke-miterlimit=".4"/><ellipse cy="2.67" cx="12.409" rx="1.522" ry="1.523" fill="#b3b3b3" stroke="#424242" stroke-width=".295" stroke-linejoin="round" stroke-miterlimit=".4"/><ellipse cy="10.589" cx="2.669" rx="1.522" ry="1.523" fill="#b3b3b3" stroke="#424242" stroke-width=".295" stroke-linejoin="round" stroke-miterlimit=".4"/><ellipse cy="13.33" cx="7.235" rx="1.522" ry="1.523" fill="#b3b3b3" stroke="#424242" stroke-width=".295" stroke-linejoin="round" stroke-miterlimit=".4"/><path d="M2.73 9.067l.183-4.57m1.582-1.571l6.393-.207m.856 1.321L7.9 11.96m-1.97.586l-1.956-1.174" fill="#b3b3b3" stroke="#424242"/></svg>
|
After Width: | Height: | Size: 815 B |
1
images/themes/default/mLayoutItemPolyline.svg
Normal file
@ -0,0 +1 @@
|
|||||||
|
<svg xmlns="http://www.w3.org/2000/svg" height="16" width="16"><ellipse cy="7.976" cx="2.642" rx="1.494" ry="1.495" fill="#b3b3b3" stroke="#424242" stroke-width=".295" stroke-linejoin="round" stroke-miterlimit=".4"/><path d="M3.962 4.012l-.848 2.545" fill="none" stroke="#424242"/><ellipse cy="2.642" cx="4.435" rx="1.494" ry="1.495" fill="#b3b3b3" stroke="#424242" stroke-width=".295" stroke-linejoin="round" stroke-miterlimit=".4"/><ellipse cy="3.24" cx="12.804" rx="1.494" ry="1.495" fill="#b3b3b3" stroke="#424242" stroke-width=".295" stroke-linejoin="round" stroke-miterlimit=".4"/><ellipse cy="13.358" cx="6.228" rx="1.494" ry="1.495" fill="#b3b3b3" stroke="#424242" stroke-width=".295" stroke-linejoin="round" stroke-miterlimit=".4"/><path d="M5.926 2.7l5.387.385M3.47 9.22l1.93 2.894" fill="none" stroke="#424242"/></svg>
|
After Width: | Height: | Size: 830 B |
1
images/themes/default/mLayoutItemScaleBar.svg
Normal file
@ -0,0 +1 @@
|
|||||||
|
<svg xmlns="http://www.w3.org/2000/svg" height="16" width="16"><path d="M6 6h4v4H6z" fill="#fff"/><path d="M2 6h4v4H2z" fill="#424242"/><path d="M11 7h2v2h-2z" fill="#424242" stroke="#424242" stroke-width="2"/><path d="M1.5 6.5h13v3h-13z" fill="none" stroke="#9a9a9a"/></svg>
|
After Width: | Height: | Size: 276 B |
1
images/themes/default/mLayoutItemShapeEllipse.svg
Normal file
@ -0,0 +1 @@
|
|||||||
|
<svg xmlns="http://www.w3.org/2000/svg" height="16" width="16"><circle cy="8" cx="8" r="5.5" fill="#f0f0f0" stroke="#9a9a9a" stroke-linejoin="round" stroke-miterlimit=".4"/></svg>
|
After Width: | Height: | Size: 180 B |
1
images/themes/default/mLayoutItemShapeRectangle.svg
Normal file
@ -0,0 +1 @@
|
|||||||
|
<svg xmlns="http://www.w3.org/2000/svg" height="16" width="16"><path d="M2.5 2.5h11v11h-11z" fill="#f0f0f0" stroke="#9a9a9a"/></svg>
|
After Width: | Height: | Size: 133 B |
1
images/themes/default/mLayoutItemShapeTriangle.svg
Normal file
@ -0,0 +1 @@
|
|||||||
|
<svg xmlns="http://www.w3.org/2000/svg" height="16" width="16"><path d="M2.5 13.5L8 2.5l5.5 11z" fill="#f0f0f0" fill-rule="evenodd" stroke="#9a9a9a" stroke-linejoin="round" stroke-miterlimit=".4"/></svg>
|
After Width: | Height: | Size: 204 B |
1
images/themes/default/mLayoutItemTable.svg
Normal file
@ -0,0 +1 @@
|
|||||||
|
<svg xmlns="http://www.w3.org/2000/svg" height="16" width="16"><path d="M1.5 1.5h13v13h-13z" fill="#e6e6e6" stroke="#9a9a9a"/><path d="M1.5 1.5h13v5h-13z" fill="#b3b3b3" stroke="#9a9a9a"/><path overflow="visible" d="M3 4h4" fill="none" stroke="#424242" stroke-width="2"/><path d="M8 4h5" fill="none" stroke="#424242" stroke-width="2"/><path overflow="visible" d="M3 8.5h4" fill="none" stroke="#b3b3b3"/><path d="M8 8.5h5" fill="none" stroke="#b3b3b3"/><path overflow="visible" d="M3 12.5h4" fill="none" stroke="#b3b3b3"/><path d="M8 12.5h5" fill="none" stroke="#b3b3b3"/><path overflow="visible" d="M3 10.5h4" fill="none" stroke="#b3b3b3"/><path d="M8 10.5h5" fill="none" stroke="#b3b3b3"/></svg>
|
After Width: | Height: | Size: 697 B |
@ -35,6 +35,8 @@ Creates a new QgsLayoutFrame belonging to the specified ``layout``.
|
|||||||
|
|
||||||
virtual int type() const;
|
virtual int type() const;
|
||||||
|
|
||||||
|
virtual QIcon icon() const;
|
||||||
|
|
||||||
virtual QString uuid() const;
|
virtual QString uuid() const;
|
||||||
|
|
||||||
|
|
||||||
|
@ -262,9 +262,14 @@ tasks.
|
|||||||
virtual int type() const;
|
virtual int type() const;
|
||||||
|
|
||||||
%Docstring
|
%Docstring
|
||||||
Return unique graphics item type identifier.
|
Returns a unique graphics item type identifier.
|
||||||
|
|
||||||
Plugin based subclasses should return an identifier greater than QgsLayoutItemRegistry.PluginItem.
|
Plugin based subclasses should return an identifier greater than QgsLayoutItemRegistry.PluginItem.
|
||||||
|
%End
|
||||||
|
|
||||||
|
virtual QIcon icon() const;
|
||||||
|
%Docstring
|
||||||
|
Returns the item's icon.
|
||||||
%End
|
%End
|
||||||
|
|
||||||
virtual QString uuid() const;
|
virtual QString uuid() const;
|
||||||
|
@ -39,6 +39,8 @@ Ownership is transferred to the layout.
|
|||||||
|
|
||||||
virtual int type() const;
|
virtual int type() const;
|
||||||
|
|
||||||
|
virtual QIcon icon() const;
|
||||||
|
|
||||||
virtual QString displayName() const;
|
virtual QString displayName() const;
|
||||||
|
|
||||||
|
|
||||||
|
@ -39,6 +39,8 @@ Ownership is transferred to the layout.
|
|||||||
|
|
||||||
virtual int type() const;
|
virtual int type() const;
|
||||||
|
|
||||||
|
virtual QIcon icon() const;
|
||||||
|
|
||||||
|
|
||||||
static QgsLayoutItemHtml *create( QgsLayout *layout ) /Factory/;
|
static QgsLayoutItemHtml *create( QgsLayout *layout ) /Factory/;
|
||||||
%Docstring
|
%Docstring
|
||||||
|
@ -42,6 +42,8 @@ The caller takes responsibility for deleting the returned object.
|
|||||||
|
|
||||||
virtual int type() const;
|
virtual int type() const;
|
||||||
|
|
||||||
|
virtual QIcon icon() const;
|
||||||
|
|
||||||
virtual QString displayName() const;
|
virtual QString displayName() const;
|
||||||
|
|
||||||
|
|
||||||
|
@ -65,6 +65,8 @@ The caller takes responsibility for deleting the returned object.
|
|||||||
|
|
||||||
virtual int type() const;
|
virtual int type() const;
|
||||||
|
|
||||||
|
virtual QIcon icon() const;
|
||||||
|
|
||||||
virtual QString displayName() const;
|
virtual QString displayName() const;
|
||||||
|
|
||||||
|
|
||||||
|
@ -39,6 +39,8 @@ Constructor for QgsLayoutItemMap, with the specified parent ``layout``.
|
|||||||
|
|
||||||
virtual int type() const;
|
virtual int type() const;
|
||||||
|
|
||||||
|
virtual QIcon icon() const;
|
||||||
|
|
||||||
|
|
||||||
void assignFreeId();
|
void assignFreeId();
|
||||||
%Docstring
|
%Docstring
|
||||||
|
@ -51,6 +51,8 @@ Constructor for QgsLayoutItemPicture, with the specified parent ``layout``.
|
|||||||
|
|
||||||
virtual int type() const;
|
virtual int type() const;
|
||||||
|
|
||||||
|
virtual QIcon icon() const;
|
||||||
|
|
||||||
|
|
||||||
static QgsLayoutItemPicture *create( QgsLayout *layout ) /Factory/;
|
static QgsLayoutItemPicture *create( QgsLayout *layout ) /Factory/;
|
||||||
%Docstring
|
%Docstring
|
||||||
|
@ -43,6 +43,8 @@ The caller takes responsibility for deleting the returned object.
|
|||||||
|
|
||||||
virtual int type() const;
|
virtual int type() const;
|
||||||
|
|
||||||
|
virtual QIcon icon() const;
|
||||||
|
|
||||||
virtual QString displayName() const;
|
virtual QString displayName() const;
|
||||||
|
|
||||||
|
|
||||||
|
@ -49,6 +49,8 @@ The caller takes responsibility for deleting the returned object.
|
|||||||
|
|
||||||
virtual int type() const;
|
virtual int type() const;
|
||||||
|
|
||||||
|
virtual QIcon icon() const;
|
||||||
|
|
||||||
virtual QString displayName() const;
|
virtual QString displayName() const;
|
||||||
|
|
||||||
|
|
||||||
|
@ -28,6 +28,8 @@ Constructor for QgsLayoutItemScaleBar, with the specified parent ``layout``.
|
|||||||
|
|
||||||
virtual int type() const;
|
virtual int type() const;
|
||||||
|
|
||||||
|
virtual QIcon icon() const;
|
||||||
|
|
||||||
|
|
||||||
static QgsLayoutItemScaleBar *create( QgsLayout *layout ) /Factory/;
|
static QgsLayoutItemScaleBar *create( QgsLayout *layout ) /Factory/;
|
||||||
%Docstring
|
%Docstring
|
||||||
|
@ -36,6 +36,8 @@ Constructor for QgsLayoutItemShape, with the specified parent ``layout``.
|
|||||||
|
|
||||||
virtual int type() const;
|
virtual int type() const;
|
||||||
|
|
||||||
|
virtual QIcon icon() const;
|
||||||
|
|
||||||
|
|
||||||
virtual QString displayName() const;
|
virtual QString displayName() const;
|
||||||
|
|
||||||
|
@ -73,6 +73,11 @@ Returns the total size of the multiframe's content, in layout units.
|
|||||||
virtual int type() const = 0;
|
virtual int type() const = 0;
|
||||||
%Docstring
|
%Docstring
|
||||||
Returns unique multiframe type id.
|
Returns unique multiframe type id.
|
||||||
|
%End
|
||||||
|
|
||||||
|
virtual QIcon icon() const;
|
||||||
|
%Docstring
|
||||||
|
Returns the item's icon.
|
||||||
%End
|
%End
|
||||||
|
|
||||||
virtual QSizeF fixedFrameSize( const int frameIndex = -1 ) const;
|
virtual QSizeF fixedFrameSize( const int frameIndex = -1 ) const;
|
||||||
|
@ -110,6 +110,14 @@ int QgsLayoutFrame::type() const
|
|||||||
return QgsLayoutItemRegistry::LayoutFrame;
|
return QgsLayoutItemRegistry::LayoutFrame;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QIcon QgsLayoutFrame::icon() const
|
||||||
|
{
|
||||||
|
if ( mMultiFrame )
|
||||||
|
return mMultiFrame->icon();
|
||||||
|
else
|
||||||
|
return QIcon();
|
||||||
|
}
|
||||||
|
|
||||||
QString QgsLayoutFrame::uuid() const
|
QString QgsLayoutFrame::uuid() const
|
||||||
{
|
{
|
||||||
if ( mMultiFrame )
|
if ( mMultiFrame )
|
||||||
|
@ -46,6 +46,7 @@ class CORE_EXPORT QgsLayoutFrame: public QgsLayoutItem
|
|||||||
static QgsLayoutFrame *create( QgsLayout *layout ) SIP_FACTORY;
|
static QgsLayoutFrame *create( QgsLayout *layout ) SIP_FACTORY;
|
||||||
|
|
||||||
int type() const override;
|
int type() const override;
|
||||||
|
QIcon icon() const override;
|
||||||
QString uuid() const override;
|
QString uuid() const override;
|
||||||
|
|
||||||
//Overridden to allow multiframe to set display name
|
//Overridden to allow multiframe to set display name
|
||||||
|
@ -25,6 +25,7 @@
|
|||||||
#include "qgslayoutundocommand.h"
|
#include "qgslayoutundocommand.h"
|
||||||
#include "qgslayoutmeasurement.h"
|
#include "qgslayoutmeasurement.h"
|
||||||
#include <QGraphicsRectItem>
|
#include <QGraphicsRectItem>
|
||||||
|
#include <QIcon>
|
||||||
#include <QPainter>
|
#include <QPainter>
|
||||||
|
|
||||||
class QgsLayout;
|
class QgsLayout;
|
||||||
@ -292,12 +293,17 @@ class CORE_EXPORT QgsLayoutItem : public QgsLayoutObject, public QGraphicsRectIt
|
|||||||
virtual void cleanup();
|
virtual void cleanup();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return unique graphics item type identifier.
|
* Returns a unique graphics item type identifier.
|
||||||
*
|
*
|
||||||
* Plugin based subclasses should return an identifier greater than QgsLayoutItemRegistry::PluginItem.
|
* Plugin based subclasses should return an identifier greater than QgsLayoutItemRegistry::PluginItem.
|
||||||
*/
|
*/
|
||||||
int type() const override;
|
int type() const override;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the item's icon.
|
||||||
|
*/
|
||||||
|
virtual QIcon icon() const { return QgsApplication::getThemeIcon( QStringLiteral( "/mLayoutItem.svg" ) ); }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the item identification string. This is a unique random string set for the item
|
* Returns the item identification string. This is a unique random string set for the item
|
||||||
* upon creation.
|
* upon creation.
|
||||||
|
@ -95,6 +95,11 @@ int QgsLayoutItemAttributeTable::type() const
|
|||||||
return QgsLayoutItemRegistry::LayoutAttributeTable;
|
return QgsLayoutItemRegistry::LayoutAttributeTable;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QIcon QgsLayoutItemAttributeTable::icon() const
|
||||||
|
{
|
||||||
|
return QgsApplication::getThemeIcon( QStringLiteral( "/mLayoutItemTable.svg" ) );
|
||||||
|
}
|
||||||
|
|
||||||
QgsLayoutItemAttributeTable *QgsLayoutItemAttributeTable::create( QgsLayout *layout )
|
QgsLayoutItemAttributeTable *QgsLayoutItemAttributeTable::create( QgsLayout *layout )
|
||||||
{
|
{
|
||||||
return new QgsLayoutItemAttributeTable( layout );
|
return new QgsLayoutItemAttributeTable( layout );
|
||||||
|
@ -56,6 +56,7 @@ class CORE_EXPORT QgsLayoutItemAttributeTable: public QgsLayoutTable
|
|||||||
QgsLayoutItemAttributeTable( QgsLayout *layout SIP_TRANSFERTHIS );
|
QgsLayoutItemAttributeTable( QgsLayout *layout SIP_TRANSFERTHIS );
|
||||||
|
|
||||||
int type() const override;
|
int type() const override;
|
||||||
|
QIcon icon() const override;
|
||||||
QString displayName() const override;
|
QString displayName() const override;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -81,6 +81,11 @@ int QgsLayoutItemHtml::type() const
|
|||||||
return QgsLayoutItemRegistry::LayoutHtml;
|
return QgsLayoutItemRegistry::LayoutHtml;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QIcon QgsLayoutItemHtml::icon() const
|
||||||
|
{
|
||||||
|
return QgsApplication::getThemeIcon( QStringLiteral( "/mLayoutItemHtml.svg" ) );
|
||||||
|
}
|
||||||
|
|
||||||
QgsLayoutItemHtml *QgsLayoutItemHtml::create( QgsLayout *layout )
|
QgsLayoutItemHtml *QgsLayoutItemHtml::create( QgsLayout *layout )
|
||||||
{
|
{
|
||||||
return new QgsLayoutItemHtml( layout );
|
return new QgsLayoutItemHtml( layout );
|
||||||
|
@ -56,6 +56,7 @@ class CORE_EXPORT QgsLayoutItemHtml: public QgsLayoutMultiFrame
|
|||||||
~QgsLayoutItemHtml() override;
|
~QgsLayoutItemHtml() override;
|
||||||
|
|
||||||
int type() const override;
|
int type() const override;
|
||||||
|
QIcon icon() const override;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns a new QgsLayoutItemHtml for the specified parent \a layout.
|
* Returns a new QgsLayoutItemHtml for the specified parent \a layout.
|
||||||
|
@ -102,6 +102,11 @@ int QgsLayoutItemLabel::type() const
|
|||||||
return QgsLayoutItemRegistry::LayoutLabel;
|
return QgsLayoutItemRegistry::LayoutLabel;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QIcon QgsLayoutItemLabel::icon() const
|
||||||
|
{
|
||||||
|
return QgsApplication::getThemeIcon( QStringLiteral( "/mLayoutItemLabel.svg" ) );
|
||||||
|
}
|
||||||
|
|
||||||
void QgsLayoutItemLabel::draw( QgsRenderContext &context, const QStyleOptionGraphicsItem * )
|
void QgsLayoutItemLabel::draw( QgsRenderContext &context, const QStyleOptionGraphicsItem * )
|
||||||
{
|
{
|
||||||
QPainter *painter = context.painter();
|
QPainter *painter = context.painter();
|
||||||
|
@ -57,6 +57,7 @@ class CORE_EXPORT QgsLayoutItemLabel: public QgsLayoutItem
|
|||||||
static QgsLayoutItemLabel *create( QgsLayout *layout ) SIP_FACTORY;
|
static QgsLayoutItemLabel *create( QgsLayout *layout ) SIP_FACTORY;
|
||||||
|
|
||||||
int type() const override;
|
int type() const override;
|
||||||
|
QIcon icon() const override;
|
||||||
//Overridden to contain part of label's text
|
//Overridden to contain part of label's text
|
||||||
QString displayName() const override;
|
QString displayName() const override;
|
||||||
|
|
||||||
|
@ -58,6 +58,11 @@ int QgsLayoutItemLegend::type() const
|
|||||||
return QgsLayoutItemRegistry::LayoutLegend;
|
return QgsLayoutItemRegistry::LayoutLegend;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QIcon QgsLayoutItemLegend::icon() const
|
||||||
|
{
|
||||||
|
return QgsApplication::getThemeIcon( QStringLiteral( "/mLayoutItemLegend.svg" ) );
|
||||||
|
}
|
||||||
|
|
||||||
void QgsLayoutItemLegend::paint( QPainter *painter, const QStyleOptionGraphicsItem *itemStyle, QWidget *pWidget )
|
void QgsLayoutItemLegend::paint( QPainter *painter, const QStyleOptionGraphicsItem *itemStyle, QWidget *pWidget )
|
||||||
{
|
{
|
||||||
if ( !painter )
|
if ( !painter )
|
||||||
|
@ -77,6 +77,7 @@ class CORE_EXPORT QgsLayoutItemLegend : public QgsLayoutItem
|
|||||||
static QgsLayoutItemLegend *create( QgsLayout *layout ) SIP_FACTORY;
|
static QgsLayoutItemLegend *create( QgsLayout *layout ) SIP_FACTORY;
|
||||||
|
|
||||||
int type() const override;
|
int type() const override;
|
||||||
|
QIcon icon() const override;
|
||||||
//Overridden to show legend title
|
//Overridden to show legend title
|
||||||
QString displayName() const override;
|
QString displayName() const override;
|
||||||
|
|
||||||
|
@ -75,6 +75,11 @@ int QgsLayoutItemMap::type() const
|
|||||||
return QgsLayoutItemRegistry::LayoutMap;
|
return QgsLayoutItemRegistry::LayoutMap;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QIcon QgsLayoutItemMap::icon() const
|
||||||
|
{
|
||||||
|
return QgsApplication::getThemeIcon( QStringLiteral( "/mLayoutItemMap.svg" ) );
|
||||||
|
}
|
||||||
|
|
||||||
void QgsLayoutItemMap::assignFreeId()
|
void QgsLayoutItemMap::assignFreeId()
|
||||||
{
|
{
|
||||||
if ( !mLayout )
|
if ( !mLayout )
|
||||||
|
@ -70,6 +70,7 @@ class CORE_EXPORT QgsLayoutItemMap : public QgsLayoutItem
|
|||||||
~QgsLayoutItemMap() override;
|
~QgsLayoutItemMap() override;
|
||||||
|
|
||||||
int type() const override;
|
int type() const override;
|
||||||
|
QIcon icon() const override;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the map id() to a number not yet used in the layout. The existing id() is kept if it is not in use.
|
* Sets the map id() to a number not yet used in the layout. The existing id() is kept if it is not in use.
|
||||||
|
@ -71,6 +71,11 @@ int QgsLayoutItemPicture::type() const
|
|||||||
return QgsLayoutItemRegistry::LayoutPicture;
|
return QgsLayoutItemRegistry::LayoutPicture;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QIcon QgsLayoutItemPicture::icon() const
|
||||||
|
{
|
||||||
|
return QgsApplication::getThemeIcon( QStringLiteral( "/mLayoutItemPicture.svg" ) );
|
||||||
|
}
|
||||||
|
|
||||||
QgsLayoutItemPicture *QgsLayoutItemPicture::create( QgsLayout *layout )
|
QgsLayoutItemPicture *QgsLayoutItemPicture::create( QgsLayout *layout )
|
||||||
{
|
{
|
||||||
return new QgsLayoutItemPicture( layout );
|
return new QgsLayoutItemPicture( layout );
|
||||||
|
@ -71,6 +71,7 @@ class CORE_EXPORT QgsLayoutItemPicture: public QgsLayoutItem
|
|||||||
QgsLayoutItemPicture( QgsLayout *layout );
|
QgsLayoutItemPicture( QgsLayout *layout );
|
||||||
|
|
||||||
int type() const override;
|
int type() const override;
|
||||||
|
QIcon icon() const override;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns a new picture item for the specified \a layout.
|
* Returns a new picture item for the specified \a layout.
|
||||||
|
@ -47,6 +47,11 @@ int QgsLayoutItemPolygon::type() const
|
|||||||
return QgsLayoutItemRegistry::LayoutPolygon;
|
return QgsLayoutItemRegistry::LayoutPolygon;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QIcon QgsLayoutItemPolygon::icon() const
|
||||||
|
{
|
||||||
|
return QgsApplication::getThemeIcon( QStringLiteral( "/mLayoutItemPolygon.svg" ) );
|
||||||
|
}
|
||||||
|
|
||||||
bool QgsLayoutItemPolygon::_addNode( const int indexPoint,
|
bool QgsLayoutItemPolygon::_addNode( const int indexPoint,
|
||||||
QPointF newPoint,
|
QPointF newPoint,
|
||||||
const double radius )
|
const double radius )
|
||||||
|
@ -52,6 +52,7 @@ class CORE_EXPORT QgsLayoutItemPolygon: public QgsLayoutNodesItem
|
|||||||
static QgsLayoutItemPolygon *create( QgsLayout *layout ) SIP_FACTORY;
|
static QgsLayoutItemPolygon *create( QgsLayout *layout ) SIP_FACTORY;
|
||||||
|
|
||||||
int type() const override;
|
int type() const override;
|
||||||
|
QIcon icon() const override;
|
||||||
QString displayName() const override;
|
QString displayName() const override;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -48,6 +48,11 @@ int QgsLayoutItemPolyline::type() const
|
|||||||
return QgsLayoutItemRegistry::LayoutPolyline;
|
return QgsLayoutItemRegistry::LayoutPolyline;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QIcon QgsLayoutItemPolyline::icon() const
|
||||||
|
{
|
||||||
|
return QgsApplication::getThemeIcon( QStringLiteral( "/mLayoutItemPolyline.svg" ) );
|
||||||
|
}
|
||||||
|
|
||||||
bool QgsLayoutItemPolyline::_addNode( const int indexPoint,
|
bool QgsLayoutItemPolyline::_addNode( const int indexPoint,
|
||||||
QPointF newPoint,
|
QPointF newPoint,
|
||||||
const double radius )
|
const double radius )
|
||||||
|
@ -59,6 +59,7 @@ class CORE_EXPORT QgsLayoutItemPolyline: public QgsLayoutNodesItem
|
|||||||
static QgsLayoutItemPolyline *create( QgsLayout *layout ) SIP_FACTORY;
|
static QgsLayoutItemPolyline *create( QgsLayout *layout ) SIP_FACTORY;
|
||||||
|
|
||||||
int type() const override;
|
int type() const override;
|
||||||
|
QIcon icon() const override;
|
||||||
QString displayName() const override;
|
QString displayName() const override;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -52,6 +52,11 @@ int QgsLayoutItemScaleBar::type() const
|
|||||||
return QgsLayoutItemRegistry::LayoutScaleBar;
|
return QgsLayoutItemRegistry::LayoutScaleBar;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QIcon QgsLayoutItemScaleBar::icon() const
|
||||||
|
{
|
||||||
|
return QgsApplication::getThemeIcon( QStringLiteral( "/mLayoutItemScaleBar.svg" ) );
|
||||||
|
}
|
||||||
|
|
||||||
QgsLayoutItemScaleBar *QgsLayoutItemScaleBar::create( QgsLayout *layout )
|
QgsLayoutItemScaleBar *QgsLayoutItemScaleBar::create( QgsLayout *layout )
|
||||||
{
|
{
|
||||||
return new QgsLayoutItemScaleBar( layout );
|
return new QgsLayoutItemScaleBar( layout );
|
||||||
|
@ -44,6 +44,7 @@ class CORE_EXPORT QgsLayoutItemScaleBar: public QgsLayoutItem
|
|||||||
QgsLayoutItemScaleBar( QgsLayout *layout );
|
QgsLayoutItemScaleBar( QgsLayout *layout );
|
||||||
|
|
||||||
int type() const override;
|
int type() const override;
|
||||||
|
QIcon icon() const override;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns a new scale bar item for the specified \a layout.
|
* Returns a new scale bar item for the specified \a layout.
|
||||||
|
@ -59,6 +59,21 @@ int QgsLayoutItemShape::type() const
|
|||||||
return QgsLayoutItemRegistry::LayoutShape;
|
return QgsLayoutItemRegistry::LayoutShape;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QIcon QgsLayoutItemShape::icon() const
|
||||||
|
{
|
||||||
|
switch ( mShape )
|
||||||
|
{
|
||||||
|
case Ellipse:
|
||||||
|
return QgsApplication::getThemeIcon( QStringLiteral( "/mLayoutItemShapeEllipse.svg" ) );
|
||||||
|
case Rectangle:
|
||||||
|
return QgsApplication::getThemeIcon( QStringLiteral( "/mLayoutItemShapeRectangle.svg" ) );
|
||||||
|
case Triangle:
|
||||||
|
return QgsApplication::getThemeIcon( QStringLiteral( "/mLayoutItemShapeTriangle.svg" ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
return QIcon();
|
||||||
|
}
|
||||||
|
|
||||||
QString QgsLayoutItemShape::displayName() const
|
QString QgsLayoutItemShape::displayName() const
|
||||||
{
|
{
|
||||||
if ( !id().isEmpty() )
|
if ( !id().isEmpty() )
|
||||||
|
@ -50,6 +50,7 @@ class CORE_EXPORT QgsLayoutItemShape : public QgsLayoutItem
|
|||||||
explicit QgsLayoutItemShape( QgsLayout *layout );
|
explicit QgsLayoutItemShape( QgsLayout *layout );
|
||||||
|
|
||||||
int type() const override;
|
int type() const override;
|
||||||
|
QIcon icon() const override;
|
||||||
|
|
||||||
//Overridden to return shape type
|
//Overridden to return shape type
|
||||||
QString displayName() const override;
|
QString displayName() const override;
|
||||||
|
@ -139,6 +139,16 @@ QVariant QgsLayoutModel::data( const QModelIndex &index, int role ) const
|
|||||||
return QVariant();
|
return QVariant();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
case Qt::DecorationRole:
|
||||||
|
if ( index.column() == ItemId )
|
||||||
|
{
|
||||||
|
return item->icon();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return QVariant();
|
||||||
|
}
|
||||||
|
|
||||||
case Qt::EditRole:
|
case Qt::EditRole:
|
||||||
if ( index.column() == ItemId )
|
if ( index.column() == ItemId )
|
||||||
{
|
{
|
||||||
|
@ -20,6 +20,7 @@
|
|||||||
#include "qgis.h"
|
#include "qgis.h"
|
||||||
#include "qgslayoutobject.h"
|
#include "qgslayoutobject.h"
|
||||||
#include "qgslayoutundocommand.h"
|
#include "qgslayoutundocommand.h"
|
||||||
|
#include <QIcon>
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
#include <QSizeF>
|
#include <QSizeF>
|
||||||
#include <QPointF>
|
#include <QPointF>
|
||||||
@ -102,6 +103,11 @@ class CORE_EXPORT QgsLayoutMultiFrame: public QgsLayoutObject, public QgsLayoutU
|
|||||||
*/
|
*/
|
||||||
virtual int type() const = 0;
|
virtual int type() const = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the item's icon.
|
||||||
|
*/
|
||||||
|
virtual QIcon icon() const { return QgsApplication::getThemeIcon( QStringLiteral( "/mLayoutItem.svg" ) ); }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the fixed size for a frame, if desired. If the fixed frame size changes,
|
* Returns the fixed size for a frame, if desired. If the fixed frame size changes,
|
||||||
* the sizes of all frames can be recalculated by calling recalculateFrameRects().
|
* the sizes of all frames can be recalculated by calling recalculateFrameRects().
|
||||||
|