Skip to content

Commit 19b0581

Browse files
committedJan 5, 2018
Add crappy inappropriate icons for layout types
1 parent 66028bc commit 19b0581

File tree

9 files changed

+32
-0
lines changed

9 files changed

+32
-0
lines changed
 

‎python/core/layout/qgsmasterlayoutinterface.sip

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,11 @@ is transferred to the caller.
3333
Returns the layout's name.
3434

3535
.. seealso:: :py:func:`setName()`
36+
%End
37+
38+
virtual QIcon icon() const = 0;
39+
%Docstring
40+
Returns an icon for the layout.
3641
%End
3742

3843
virtual void setName( const QString &name ) = 0;

‎python/core/layout/qgsprintlayout.sip

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@ Constructor for QgsPrintLayout.
3030

3131
virtual QgsProject *layoutProject() const;
3232

33+
virtual QIcon icon() const;
34+
3335

3436
QgsLayoutAtlas *atlas();
3537
%Docstring

‎python/core/layout/qgsreport.sip

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@ Note that ownership is not transferred to ``project``.
3939
%End
4040

4141
virtual QString type() const;
42+
virtual QIcon icon() const;
43+
4244
virtual QgsProject *layoutProject() const;
4345
virtual QgsReport *clone() const /Factory/;
4446

‎src/app/layout/qgslayoutmanagerdialog.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -523,6 +523,11 @@ QVariant QgsLayoutManagerModel::data( const QModelIndex &index, int role ) const
523523
return QVariant();
524524
}
525525

526+
case Qt::DecorationRole:
527+
{
528+
return mLayoutManager->layouts().at( index.row() )->icon();
529+
}
530+
526531
default:
527532
return QVariant();
528533
}

‎src/core/layout/qgsmasterlayoutinterface.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
#include "qgis_core.h"
2020
#include "qgis_sip.h"
2121
#include <QString>
22+
#include <QIcon>
2223

2324
/**
2425
* \ingroup core
@@ -45,6 +46,11 @@ class CORE_EXPORT QgsMasterLayoutInterface
4546
*/
4647
virtual QString name() const = 0;
4748

49+
/**
50+
* Returns an icon for the layout.
51+
*/
52+
virtual QIcon icon() const = 0;
53+
4854
/**
4955
* Sets the layout's name.
5056
* \see name()

‎src/core/layout/qgsprintlayout.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,11 @@ QgsProject *QgsPrintLayout::layoutProject() const
4848
return project();
4949
}
5050

51+
QIcon QgsPrintLayout::icon() const
52+
{
53+
return QgsApplication::getThemeIcon( QStringLiteral( "mActionNewComposer.svg" ) );
54+
}
55+
5156
QgsLayoutAtlas *QgsPrintLayout::atlas()
5257
{
5358
return mAtlas;

‎src/core/layout/qgsprintlayout.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ class CORE_EXPORT QgsPrintLayout : public QgsLayout, public QgsMasterLayoutInter
4141

4242
QgsPrintLayout *clone() const override SIP_FACTORY;
4343
QgsProject *layoutProject() const override;
44+
QIcon icon() const override;
4445

4546
/**
4647
* Returns the print layout's atlas.

‎src/core/layout/qgsreport.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,11 @@ QgsReport::QgsReport( QgsProject *project )
2424
, mProject( project )
2525
{}
2626

27+
QIcon QgsReport::icon() const
28+
{
29+
return QgsApplication::getThemeIcon( QStringLiteral( "processingResult.svg" ) );
30+
}
31+
2732
QgsReport *QgsReport::clone() const
2833
{
2934
std::unique_ptr< QgsReport > copy = qgis::make_unique< QgsReport >( mProject );

‎src/core/layout/qgsreport.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ class CORE_EXPORT QgsReport : public QObject, public QgsAbstractReportSection, p
5353
QgsReport( QgsProject *project );
5454

5555
QString type() const override { return QStringLiteral( "SectionReport" ); }
56+
QIcon icon() const override;
5657
QgsProject *layoutProject() const override { return mProject; }
5758
QgsReport *clone() const override SIP_FACTORY;
5859
QString name() const override { return mName; }

0 commit comments

Comments
 (0)
Please sign in to comment.