Skip to content

Commit 30fb6de

Browse files
committedDec 13, 2017
Use qgs project icon derivative for project home in browser
1 parent b6ddc70 commit 30fb6de

File tree

6 files changed

+205
-2
lines changed

6 files changed

+205
-2
lines changed
 

‎images/images.qrc

100644100755
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -613,6 +613,7 @@
613613
<file>themes/default/cursors/mZoomIn.svg</file>
614614
<file>themes/default/cursors/mZoomOut.svg</file>
615615
<file>themes/default/cursors/mIdentify.svg</file>
616+
<file>themes/default/mIconQgsProjectFile.svg</file>
616617
</qresource>
617618
<qresource prefix="/images/tips">
618619
<file alias="symbol_levels.png">qgis_tips/symbol_levels.png</file>
Lines changed: 159 additions & 0 deletions
Loading

‎python/core/qgsdataitem.sip

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -749,6 +749,9 @@ class QgsZipItem : QgsDataCollectionItem
749749

750750

751751

752+
753+
754+
752755
/************************************************************************
753756
* This file has been generated automatically from *
754757
* *

‎src/core/qgsbrowsermodel.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,10 +69,9 @@ void QgsBrowserModel::updateProjectHome()
6969
endRemoveRows();
7070
}
7171
delete mProjectHome;
72-
mProjectHome = home.isNull() ? nullptr : new QgsDirectoryItem( nullptr, tr( "Project home" ), home, "project:" + home );
72+
mProjectHome = home.isNull() ? nullptr : new QgsProjectHomeItem( nullptr, tr( "Project home" ), home, "project:" + home );
7373
if ( mProjectHome )
7474
{
75-
mProjectHome->setSortKey( QStringLiteral( " 1" ) );
7675
connectItem( mProjectHome );
7776

7877
beginInsertRows( QModelIndex(), 0, 0 );

‎src/core/qgsdataitem.cpp

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1540,3 +1540,22 @@ QStringList QgsZipItem::getZipFileList()
15401540

15411541
return mZipFileList;
15421542
}
1543+
1544+
///@cond PRIVATE
1545+
///
1546+
QgsProjectHomeItem::QgsProjectHomeItem( QgsDataItem *parent, const QString &name, const QString &dirPath, const QString &path )
1547+
: QgsDirectoryItem( parent, name, dirPath, path )
1548+
{
1549+
}
1550+
1551+
QIcon QgsProjectHomeItem::icon()
1552+
{
1553+
return QgsApplication::getThemeIcon( QStringLiteral( "mIconQgsProjectFile.svg" ) );
1554+
}
1555+
1556+
QVariant QgsProjectHomeItem::sortKey() const
1557+
{
1558+
return QStringLiteral( " 1" );
1559+
}
1560+
1561+
///@endcond

‎src/core/qgsdataitem.h

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -703,6 +703,28 @@ class CORE_EXPORT QgsZipItem : public QgsDataCollectionItem
703703
void init();
704704
};
705705

706+
707+
///@cond PRIVATE
708+
#ifndef SIP_RUN
709+
710+
/**
711+
* \ingroup core
712+
* A directory item showing the current project directory.
713+
* \since QGIS 3.0
714+
*/
715+
class CORE_EXPORT QgsProjectHomeItem : public QgsDirectoryItem
716+
{
717+
public:
718+
719+
QgsProjectHomeItem( QgsDataItem *parent, const QString &name, const QString &dirPath, const QString &path );
720+
721+
QIcon icon() override;
722+
QVariant sortKey() const override;
723+
724+
};
725+
#endif
726+
727+
706728
#endif // QGSDATAITEM_H
707729

708730

0 commit comments

Comments
 (0)
Please sign in to comment.