Skip to content

Commit 457abe7

Browse files
authored
Merge pull request #5859 from nyalldawson/project_icon
Use qgs project icon derivative for project home in browser
2 parents ea49c82 + 79c180a commit 457abe7

File tree

7 files changed

+207
-5
lines changed

7 files changed

+207
-5
lines changed

images/images.qrc

100644100755
+1
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>
Loading

python/core/qgsdataitem.sip

+2
Original file line numberDiff line numberDiff line change
@@ -749,6 +749,8 @@ class QgsZipItem : QgsDataCollectionItem
749749

750750

751751

752+
753+
752754
/************************************************************************
753755
* This file has been generated automatically from *
754756
* *

python/plugins/processing/ProcessingPlugin.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -130,10 +130,10 @@ def editModel(self):
130130
dlg.loadModel(self.path())
131131
dlg.show()
132132

133-
def actions(self):
134-
run_model_action = QAction(QCoreApplication.translate('ProcessingPlugin', '&Run Model…'), self)
133+
def actions(self, parent):
134+
run_model_action = QAction(QCoreApplication.translate('ProcessingPlugin', '&Run Model…'), parent)
135135
run_model_action.triggered.connect(self.runModel)
136-
edit_model_action = QAction(QCoreApplication.translate('ProcessingPlugin', '&Edit Model…'), self)
136+
edit_model_action = QAction(QCoreApplication.translate('ProcessingPlugin', '&Edit Model…'), parent)
137137
edit_model_action.triggered.connect(self.editModel)
138138
return [run_model_action, edit_model_action]
139139

src/core/qgsbrowsermodel.cpp

+1-2
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

+19
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

+22
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+
///@endcond
727+
706728
#endif // QGSDATAITEM_H
707729

708730

0 commit comments

Comments
 (0)