Skip to content
Permalink
Browse files
Allow fill/stroke color to be specified for QgsDataItem::iconDir/open…
…DirIcon
  • Loading branch information
nyalldawson committed May 17, 2021
1 parent cd6aa7f commit 2aa70400cecaf06b29685c64bc660cc62ab01306
Showing with 26 additions and 8 deletions.
  1. +8 −2 python/core/auto_generated/qgsdataitem.sip.in
  2. +8 −4 src/core/qgsdataitem.cpp
  3. +10 −2 src/core/qgsdataitem.h
@@ -687,10 +687,13 @@ The optional ``providerKey`` string can be used to specify the key for the :py:c

void addChild( QgsDataItem *item /Transfer/ );

static QIcon iconDir();
static QIcon iconDir( const QColor &fillColor = QColor(), const QColor &strokeColor = QColor() );
%Docstring
Returns the standard browser directory icon.

Since QGIS 3.20 the optional ``fillColor`` and ``strokeColor`` arguments can be used to specify
a fill and stroke color for the icon.

.. seealso:: :py:func:`iconDataCollection`
%End

@@ -706,10 +709,13 @@ Returns the standard browser data collection icon.

protected:

static QIcon openDirIcon();
static QIcon openDirIcon( const QColor &fillColor = QColor(), const QColor &strokeColor = QColor() );
%Docstring
Shared open directory icon.

Since QGIS 3.20 the optional ``fillColor`` and ``strokeColor`` arguments can be used to specify
a fill and stroke color for the icon.

.. versionadded:: 3.4
%End

@@ -123,9 +123,11 @@ QIcon QgsDataCollectionItem::iconDataCollection()
return QgsApplication::getThemeIcon( QStringLiteral( "/mIconDbSchema.svg" ) );
}

QIcon QgsDataCollectionItem::openDirIcon()
QIcon QgsDataCollectionItem::openDirIcon( const QColor &fillColor, const QColor &strokeColor )
{
return QgsApplication::getThemeIcon( QStringLiteral( "/mIconFolderOpen.svg" ) );
return fillColor.isValid() || strokeColor.isValid()
? QgsApplication::getThemeIcon( QStringLiteral( "/mIconFolderOpenParams.svg" ), fillColor, strokeColor )
: QgsApplication::getThemeIcon( QStringLiteral( "/mIconFolderOpen.svg" ) );
}

QIcon QgsDataCollectionItem::homeDirIcon()
@@ -171,9 +173,11 @@ QgsAbstractDatabaseProviderConnection *QgsDataCollectionItem::databaseConnection
return nullptr;
}

QIcon QgsDataCollectionItem::iconDir()
QIcon QgsDataCollectionItem::iconDir( const QColor &fillColor, const QColor &strokeColor )
{
return QgsApplication::getThemeIcon( QStringLiteral( "/mIconFolder.svg" ) );
return fillColor.isValid() || strokeColor.isValid()
? QgsApplication::getThemeIcon( QStringLiteral( "/mIconFolderParams.svg" ), fillColor, strokeColor )
: QgsApplication::getThemeIcon( QStringLiteral( "/mIconFolder.svg" ) );
}


@@ -703,9 +703,13 @@ class CORE_EXPORT QgsDataCollectionItem : public QgsDataItem

/**
* Returns the standard browser directory icon.
*
* Since QGIS 3.20 the optional \a fillColor and \a strokeColor arguments can be used to specify
* a fill and stroke color for the icon.
*
* \see iconDataCollection()
*/
static QIcon iconDir();
static QIcon iconDir( const QColor &fillColor = QColor(), const QColor &strokeColor = QColor() );

/**
* Returns the standard browser data collection icon.
@@ -719,9 +723,13 @@ class CORE_EXPORT QgsDataCollectionItem : public QgsDataItem

/**
* Shared open directory icon.
*
* Since QGIS 3.20 the optional \a fillColor and \a strokeColor arguments can be used to specify
* a fill and stroke color for the icon.
*
* \since QGIS 3.4
*/
static QIcon openDirIcon();
static QIcon openDirIcon( const QColor &fillColor = QColor(), const QColor &strokeColor = QColor() );

/**
* Shared home directory icon.

0 comments on commit 2aa7040

Please sign in to comment.