Skip to content

Commit

Permalink
Add crappy inappropriate icons for layout types
Browse files Browse the repository at this point in the history
  • Loading branch information
nyalldawson committed Jan 5, 2018
1 parent 66028bc commit 19b0581
Show file tree
Hide file tree
Showing 9 changed files with 32 additions and 0 deletions.
5 changes: 5 additions & 0 deletions python/core/layout/qgsmasterlayoutinterface.sip
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,11 @@ is transferred to the caller.
Returns the layout's name.

.. seealso:: :py:func:`setName()`
%End

virtual QIcon icon() const = 0;
%Docstring
Returns an icon for the layout.
%End

virtual void setName( const QString &name ) = 0;
Expand Down
2 changes: 2 additions & 0 deletions python/core/layout/qgsprintlayout.sip
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ Constructor for QgsPrintLayout.

virtual QgsProject *layoutProject() const;

virtual QIcon icon() const;


QgsLayoutAtlas *atlas();
%Docstring
Expand Down
2 changes: 2 additions & 0 deletions python/core/layout/qgsreport.sip
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ Note that ownership is not transferred to ``project``.
%End

virtual QString type() const;
virtual QIcon icon() const;

virtual QgsProject *layoutProject() const;
virtual QgsReport *clone() const /Factory/;

Expand Down
5 changes: 5 additions & 0 deletions src/app/layout/qgslayoutmanagerdialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -523,6 +523,11 @@ QVariant QgsLayoutManagerModel::data( const QModelIndex &index, int role ) const
return QVariant();
}

case Qt::DecorationRole:
{
return mLayoutManager->layouts().at( index.row() )->icon();
}

default:
return QVariant();
}
Expand Down
6 changes: 6 additions & 0 deletions src/core/layout/qgsmasterlayoutinterface.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
#include "qgis_core.h"
#include "qgis_sip.h"
#include <QString>
#include <QIcon>

/**
* \ingroup core
Expand All @@ -45,6 +46,11 @@ class CORE_EXPORT QgsMasterLayoutInterface
*/
virtual QString name() const = 0;

/**
* Returns an icon for the layout.
*/
virtual QIcon icon() const = 0;

/**
* Sets the layout's name.
* \see name()
Expand Down
5 changes: 5 additions & 0 deletions src/core/layout/qgsprintlayout.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,11 @@ QgsProject *QgsPrintLayout::layoutProject() const
return project();
}

QIcon QgsPrintLayout::icon() const
{
return QgsApplication::getThemeIcon( QStringLiteral( "mActionNewComposer.svg" ) );
}

QgsLayoutAtlas *QgsPrintLayout::atlas()
{
return mAtlas;
Expand Down
1 change: 1 addition & 0 deletions src/core/layout/qgsprintlayout.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ class CORE_EXPORT QgsPrintLayout : public QgsLayout, public QgsMasterLayoutInter

QgsPrintLayout *clone() const override SIP_FACTORY;
QgsProject *layoutProject() const override;
QIcon icon() const override;

/**
* Returns the print layout's atlas.
Expand Down
5 changes: 5 additions & 0 deletions src/core/layout/qgsreport.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,11 @@ QgsReport::QgsReport( QgsProject *project )
, mProject( project )
{}

QIcon QgsReport::icon() const
{
return QgsApplication::getThemeIcon( QStringLiteral( "processingResult.svg" ) );
}

QgsReport *QgsReport::clone() const
{
std::unique_ptr< QgsReport > copy = qgis::make_unique< QgsReport >( mProject );
Expand Down
1 change: 1 addition & 0 deletions src/core/layout/qgsreport.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ class CORE_EXPORT QgsReport : public QObject, public QgsAbstractReportSection, p
QgsReport( QgsProject *project );

QString type() const override { return QStringLiteral( "SectionReport" ); }
QIcon icon() const override;
QgsProject *layoutProject() const override { return mProject; }
QgsReport *clone() const override SIP_FACTORY;
QString name() const override { return mName; }
Expand Down

0 comments on commit 19b0581

Please sign in to comment.