Skip to content

Commit

Permalink
Use a custom folder icon instead of O/S folder icon
Browse files Browse the repository at this point in the history
...because using O/S folder icon can causes crashes.

Fixes #18260
  • Loading branch information
nyalldawson committed Oct 1, 2018
1 parent 08cece2 commit 5508ea0
Show file tree
Hide file tree
Showing 7 changed files with 12 additions and 34 deletions.
2 changes: 2 additions & 0 deletions images/images.qrc
Expand Up @@ -714,6 +714,8 @@
<file>themes/default/mActionReverseLine.svg</file>
<file>themes/default/mActionAdd3DMap.svg</file>
<file>themes/default/mIndicatorNonRemovable.svg</file>
<file>themes/default/mIconFolder.svg</file>
<file>themes/default/mIconFolderOpen.svg</file>
</qresource>
<qresource prefix="/images/tips">
<file alias="symbol_levels.png">qgis_tips/symbol_levels.png</file>
Expand Down
1 change: 1 addition & 0 deletions images/themes/default/mIconFolder.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions images/themes/default/mIconFolderOpen.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 1 addition & 5 deletions python/plugins/processing/gui/ConfigDialog.py
Expand Up @@ -111,11 +111,7 @@ def __init__(self, showSearch=True):
super(ConfigDialog, self).__init__(None)
self.setupUi(self)

self.groupIcon = QIcon()
self.groupIcon.addPixmap(self.style().standardPixmap(
QStyle.SP_DirClosedIcon, None), QIcon.Normal, QIcon.Off)
self.groupIcon.addPixmap(self.style().standardPixmap(
QStyle.SP_DirOpenIcon, None), QIcon.Normal, QIcon.On)
self.groupIcon = QgsApplication.getThemeIcon('mIconFolder.svg')

self.model = QStandardItemModel()
self.tree.setModel(self.model)
Expand Down
4 changes: 2 additions & 2 deletions python/plugins/processing/gui/HistoryDialog.py
Expand Up @@ -28,6 +28,7 @@
import os
import warnings

from qgis.core import QgsApplication
from qgis.gui import QgsGui
from qgis.PyQt import uic
from qgis.PyQt.QtCore import Qt, QCoreApplication
Expand All @@ -52,8 +53,7 @@ def __init__(self):

QgsGui.instance().enableAutoGeometryRestore(self)

self.groupIcon = self.style().standardIcon(
QStyle.SP_DirClosedIcon)
self.groupIcon = QgsApplication.getThemeIcon('mIconFolder.svg')

self.keyIcon = self.style().standardIcon(QStyle.SP_FileIcon)

Expand Down
6 changes: 2 additions & 4 deletions src/app/qgssettingstree.cpp
Expand Up @@ -45,6 +45,7 @@
#include "qgsvariantdelegate.h"
#include "qgslogger.h"
#include "qgssettings.h"
#include "qgsapplication.h"

QgsSettingsTree::QgsSettingsTree( QWidget *parent )
: QTreeWidget( parent )
Expand All @@ -62,10 +63,7 @@ QgsSettingsTree::QgsSettingsTree( QWidget *parent )

mRefreshTimer.setInterval( 2000 );

mGroupIcon.addPixmap( style()->standardPixmap( QStyle::SP_DirClosedIcon ),
QIcon::Normal, QIcon::Off );
mGroupIcon.addPixmap( style()->standardPixmap( QStyle::SP_DirOpenIcon ),
QIcon::Normal, QIcon::On );
mGroupIcon = QgsApplication::getThemeIcon( QStringLiteral( "mIconFolderOpen.svg" ) );
mKeyIcon = style()->standardIcon( QStyle::SP_FileIcon );

setEditTriggers( QAbstractItemView::AllEditTriggers );
Expand Down
26 changes: 3 additions & 23 deletions src/core/qgsdataitem.cpp
Expand Up @@ -91,32 +91,12 @@ QIcon QgsDataCollectionItem::iconDataCollection()

QIcon QgsDataCollectionItem::openDirIcon()
{
static QIcon sIcon;

if ( sIcon.isNull() )
{
// initialize shared icons
QStyle *style = QApplication::style();
sIcon = QIcon( style->standardIcon( QStyle::SP_DirOpenIcon ) );
}

return sIcon;
return QgsApplication::getThemeIcon( QStringLiteral( "/mIconFolderOpen.svg" ) );
}

QIcon QgsDataCollectionItem::iconDir()
{
static QIcon sIcon;

if ( sIcon.isNull() )
{
// initialize shared icons
QStyle *style = QApplication::style();
sIcon = QIcon( style->standardIcon( QStyle::SP_DirClosedIcon ) );
sIcon.addPixmap( style->standardPixmap( QStyle::SP_DirOpenIcon ),
QIcon::Normal, QIcon::On );
}

return sIcon;
return QgsApplication::getThemeIcon( QStringLiteral( "/mIconFolder.svg" ) );
}

QIcon QgsFavoritesItem::iconFavorites()
Expand Down Expand Up @@ -981,7 +961,7 @@ QgsDirectoryParamWidget::QgsDirectoryParamWidget( const QString &path, QWidget *
setHeaderLabels( labels );

QStyle *style = QApplication::style();
QIcon iconDirectory = QIcon( style->standardIcon( QStyle::SP_DirClosedIcon ) );
QIcon iconDirectory = QgsApplication::getThemeIcon( QStringLiteral( "mIconFolderOpen.svg" ) );
QIcon iconFile = QIcon( style->standardIcon( QStyle::SP_FileIcon ) );
QIcon iconDirLink = QIcon( style->standardIcon( QStyle::SP_DirLinkIcon ) );
QIcon iconFileLink = QIcon( style->standardIcon( QStyle::SP_FileLinkIcon ) );
Expand Down

0 comments on commit 5508ea0

Please sign in to comment.