Skip to content

Commit

Permalink
Use qgs project icon derivative for project home in browser
Browse files Browse the repository at this point in the history
  • Loading branch information
nyalldawson committed Dec 13, 2017
1 parent b6ddc70 commit 30fb6de
Show file tree
Hide file tree
Showing 6 changed files with 205 additions and 2 deletions.
1 change: 1 addition & 0 deletions images/images.qrc
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -613,6 +613,7 @@
<file>themes/default/cursors/mZoomIn.svg</file>
<file>themes/default/cursors/mZoomOut.svg</file>
<file>themes/default/cursors/mIdentify.svg</file>
<file>themes/default/mIconQgsProjectFile.svg</file>
</qresource>
<qresource prefix="/images/tips">
<file alias="symbol_levels.png">qgis_tips/symbol_levels.png</file>
Expand Down
159 changes: 159 additions & 0 deletions images/themes/default/mIconQgsProjectFile.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions python/core/qgsdataitem.sip
Original file line number Diff line number Diff line change
Expand Up @@ -749,6 +749,9 @@ class QgsZipItem : QgsDataCollectionItem






/************************************************************************
* This file has been generated automatically from *
* *
Expand Down
3 changes: 1 addition & 2 deletions src/core/qgsbrowsermodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,9 @@ void QgsBrowserModel::updateProjectHome()
endRemoveRows();
}
delete mProjectHome;
mProjectHome = home.isNull() ? nullptr : new QgsDirectoryItem( nullptr, tr( "Project home" ), home, "project:" + home );
mProjectHome = home.isNull() ? nullptr : new QgsProjectHomeItem( nullptr, tr( "Project home" ), home, "project:" + home );
if ( mProjectHome )
{
mProjectHome->setSortKey( QStringLiteral( " 1" ) );
connectItem( mProjectHome );

beginInsertRows( QModelIndex(), 0, 0 );
Expand Down
19 changes: 19 additions & 0 deletions src/core/qgsdataitem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1540,3 +1540,22 @@ QStringList QgsZipItem::getZipFileList()

return mZipFileList;
}

///@cond PRIVATE
///
QgsProjectHomeItem::QgsProjectHomeItem( QgsDataItem *parent, const QString &name, const QString &dirPath, const QString &path )
: QgsDirectoryItem( parent, name, dirPath, path )
{
}

QIcon QgsProjectHomeItem::icon()
{
return QgsApplication::getThemeIcon( QStringLiteral( "mIconQgsProjectFile.svg" ) );
}

QVariant QgsProjectHomeItem::sortKey() const
{
return QStringLiteral( " 1" );
}

///@endcond
22 changes: 22 additions & 0 deletions src/core/qgsdataitem.h
Original file line number Diff line number Diff line change
Expand Up @@ -703,6 +703,28 @@ class CORE_EXPORT QgsZipItem : public QgsDataCollectionItem
void init();
};


///@cond PRIVATE
#ifndef SIP_RUN

/**
* \ingroup core
* A directory item showing the current project directory.
* \since QGIS 3.0
*/
class CORE_EXPORT QgsProjectHomeItem : public QgsDirectoryItem
{
public:

QgsProjectHomeItem( QgsDataItem *parent, const QString &name, const QString &dirPath, const QString &path );

QIcon icon() override;
QVariant sortKey() const override;

};
#endif


#endif // QGSDATAITEM_H


0 comments on commit 30fb6de

Please sign in to comment.