Use a custom folder icon instead of O/S folder icon

...because using O/S folder icon can causes crashes.

Fixes #18260
This commit is contained in:
Nyall Dawson 2018-10-01 15:16:03 +10:00
parent 08cece22b0
commit 5508ea036e
7 changed files with 12 additions and 34 deletions

View File

@ -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>

View File

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16"><path d="M1 2v11s0 1 1 1h12s1 0 1-1V4c0-1-1-1-1-1H9L7 1H2S1 1 1 2z" fill="#5c616c"/></svg>

After

Width:  |  Height:  |  Size: 153 B

View File

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16"><path class="ColorScheme-Text" d="M2 1S1 1 1 2v3c0-1 1-1 1-1h5l2 2h5s1 0 1 1V4c0-1-1-1-1-1H9L7 1H2z" fill="#5c616c" opacity=".3"/><path class="ColorScheme-Text" d="M2 5S1 5 1 6v7s0 1 1 1h12s1 0 1-1V8c0-1-1-1-1-1H9L7 5H2z" fill="#5c616c"/></svg>

After

Width:  |  Height:  |  Size: 309 B

View File

@ -111,11 +111,7 @@ class ConfigDialog(BASE, WIDGET):
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)

View File

@ -28,6 +28,7 @@ __revision__ = '$Format:%H$'
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
@ -52,8 +53,7 @@ class HistoryDialog(BASE, WIDGET):
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)

View File

@ -45,6 +45,7 @@
#include "qgsvariantdelegate.h"
#include "qgslogger.h"
#include "qgssettings.h"
#include "qgsapplication.h"
QgsSettingsTree::QgsSettingsTree( QWidget *parent )
: QTreeWidget( parent )
@ -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 );

View File

@ -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()
@ -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 ) );