Skip to content

Commit 5508ea0

Browse files
committed
Use a custom folder icon instead of O/S folder icon
...because using O/S folder icon can causes crashes. Fixes #18260
1 parent 08cece2 commit 5508ea0

File tree

7 files changed

+12
-34
lines changed

7 files changed

+12
-34
lines changed

images/images.qrc

+2
Original file line numberDiff line numberDiff line change
@@ -714,6 +714,8 @@
714714
<file>themes/default/mActionReverseLine.svg</file>
715715
<file>themes/default/mActionAdd3DMap.svg</file>
716716
<file>themes/default/mIndicatorNonRemovable.svg</file>
717+
<file>themes/default/mIconFolder.svg</file>
718+
<file>themes/default/mIconFolderOpen.svg</file>
717719
</qresource>
718720
<qresource prefix="/images/tips">
719721
<file alias="symbol_levels.png">qgis_tips/symbol_levels.png</file>

images/themes/default/mIconFolder.svg

+1
Loading
Loading

python/plugins/processing/gui/ConfigDialog.py

+1-5
Original file line numberDiff line numberDiff line change
@@ -111,11 +111,7 @@ def __init__(self, showSearch=True):
111111
super(ConfigDialog, self).__init__(None)
112112
self.setupUi(self)
113113

114-
self.groupIcon = QIcon()
115-
self.groupIcon.addPixmap(self.style().standardPixmap(
116-
QStyle.SP_DirClosedIcon, None), QIcon.Normal, QIcon.Off)
117-
self.groupIcon.addPixmap(self.style().standardPixmap(
118-
QStyle.SP_DirOpenIcon, None), QIcon.Normal, QIcon.On)
114+
self.groupIcon = QgsApplication.getThemeIcon('mIconFolder.svg')
119115

120116
self.model = QStandardItemModel()
121117
self.tree.setModel(self.model)

python/plugins/processing/gui/HistoryDialog.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
import os
2929
import warnings
3030

31+
from qgis.core import QgsApplication
3132
from qgis.gui import QgsGui
3233
from qgis.PyQt import uic
3334
from qgis.PyQt.QtCore import Qt, QCoreApplication
@@ -52,8 +53,7 @@ def __init__(self):
5253

5354
QgsGui.instance().enableAutoGeometryRestore(self)
5455

55-
self.groupIcon = self.style().standardIcon(
56-
QStyle.SP_DirClosedIcon)
56+
self.groupIcon = QgsApplication.getThemeIcon('mIconFolder.svg')
5757

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

src/app/qgssettingstree.cpp

+2-4
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@
4545
#include "qgsvariantdelegate.h"
4646
#include "qgslogger.h"
4747
#include "qgssettings.h"
48+
#include "qgsapplication.h"
4849

4950
QgsSettingsTree::QgsSettingsTree( QWidget *parent )
5051
: QTreeWidget( parent )
@@ -62,10 +63,7 @@ QgsSettingsTree::QgsSettingsTree( QWidget *parent )
6263

6364
mRefreshTimer.setInterval( 2000 );
6465

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

7169
setEditTriggers( QAbstractItemView::AllEditTriggers );

src/core/qgsdataitem.cpp

+3-23
Original file line numberDiff line numberDiff line change
@@ -91,32 +91,12 @@ QIcon QgsDataCollectionItem::iconDataCollection()
9191

9292
QIcon QgsDataCollectionItem::openDirIcon()
9393
{
94-
static QIcon sIcon;
95-
96-
if ( sIcon.isNull() )
97-
{
98-
// initialize shared icons
99-
QStyle *style = QApplication::style();
100-
sIcon = QIcon( style->standardIcon( QStyle::SP_DirOpenIcon ) );
101-
}
102-
103-
return sIcon;
94+
return QgsApplication::getThemeIcon( QStringLiteral( "/mIconFolderOpen.svg" ) );
10495
}
10596

10697
QIcon QgsDataCollectionItem::iconDir()
10798
{
108-
static QIcon sIcon;
109-
110-
if ( sIcon.isNull() )
111-
{
112-
// initialize shared icons
113-
QStyle *style = QApplication::style();
114-
sIcon = QIcon( style->standardIcon( QStyle::SP_DirClosedIcon ) );
115-
sIcon.addPixmap( style->standardPixmap( QStyle::SP_DirOpenIcon ),
116-
QIcon::Normal, QIcon::On );
117-
}
118-
119-
return sIcon;
99+
return QgsApplication::getThemeIcon( QStringLiteral( "/mIconFolder.svg" ) );
120100
}
121101

122102
QIcon QgsFavoritesItem::iconFavorites()
@@ -981,7 +961,7 @@ QgsDirectoryParamWidget::QgsDirectoryParamWidget( const QString &path, QWidget *
981961
setHeaderLabels( labels );
982962

983963
QStyle *style = QApplication::style();
984-
QIcon iconDirectory = QIcon( style->standardIcon( QStyle::SP_DirClosedIcon ) );
964+
QIcon iconDirectory = QgsApplication::getThemeIcon( QStringLiteral( "mIconFolderOpen.svg" ) );
985965
QIcon iconFile = QIcon( style->standardIcon( QStyle::SP_FileIcon ) );
986966
QIcon iconDirLink = QIcon( style->standardIcon( QStyle::SP_DirLinkIcon ) );
987967
QIcon iconFileLink = QIcon( style->standardIcon( QStyle::SP_FileLinkIcon ) );

0 commit comments

Comments
 (0)