Skip to content

Commit

Permalink
Merge pull request #5859 from nyalldawson/project_icon
Browse files Browse the repository at this point in the history
 Use qgs project icon derivative for project home in browser
  • Loading branch information
nyalldawson committed Dec 13, 2017
2 parents ea49c82 + 79c180a commit 457abe7
Show file tree
Hide file tree
Showing 7 changed files with 207 additions and 5 deletions.
1 change: 1 addition & 0 deletions images/images.qrc 100644 → 100755
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
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 2 additions & 0 deletions python/core/qgsdataitem.sip
Expand Up @@ -749,6 +749,8 @@ class QgsZipItem : QgsDataCollectionItem





/************************************************************************
* This file has been generated automatically from *
* *
Expand Down
6 changes: 3 additions & 3 deletions python/plugins/processing/ProcessingPlugin.py
Expand Up @@ -130,10 +130,10 @@ def editModel(self):
dlg.loadModel(self.path())
dlg.show()

def actions(self):
run_model_action = QAction(QCoreApplication.translate('ProcessingPlugin', '&Run Model…'), self)
def actions(self, parent):
run_model_action = QAction(QCoreApplication.translate('ProcessingPlugin', '&Run Model…'), parent)
run_model_action.triggered.connect(self.runModel)
edit_model_action = QAction(QCoreApplication.translate('ProcessingPlugin', '&Edit Model…'), self)
edit_model_action = QAction(QCoreApplication.translate('ProcessingPlugin', '&Edit Model…'), parent)
edit_model_action.triggered.connect(self.editModel)
return [run_model_action, edit_model_action]

Expand Down
3 changes: 1 addition & 2 deletions src/core/qgsbrowsermodel.cpp
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
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
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
///@endcond

#endif // QGSDATAITEM_H


0 comments on commit 457abe7

Please sign in to comment.