29#include <QApplication>
32#include <QDomDocument>
35#include <QRegularExpression>
40#include "moc_qgscptcityarchive.cpp"
42using namespace Qt::StringLiterals;
53 return *sArchiveRegistry();
64 const auto constEntryList = QDir( mBaseDir ).entryList( QDir::Dirs | QDir::NoDotAndDotDot, QDir::Name );
65 for (
const QString &path : constEntryList )
67 if ( path ==
"selections"_L1 )
72 mRootItems << dirItem;
79 const QDir seldir( mBaseDir +
'/' +
"selections" );
81 const QStringList fileList = seldir.entryList( QStringList() << u
"*.xml"_s, QDir::Files );
82 for (
const QString &selfile : fileList )
86 seldir.dirName() +
'/' + selfile );
89 mSelectionItems << selItem;
98 mRootItems.prepend( allRampsItem );
101 mSelectionItems.prepend( allRampsItem );
106 const auto constMRootItems = mRootItems;
109 const auto constMSelectionItems = mSelectionItems;
113 mSelectionItems.clear();
120 if ( ! mBaseDir.isNull() )
132 return archive->baseDir();
156 if ( startDir.isEmpty() || ! startDir.startsWith(
baseDir ) )
159 QDir dir = QDir( startDir );
161 while ( ! dir.exists( target ) && dir.path() !=
baseDir )
166 if ( ! dir.exists( target ) )
169 return dir.path() +
'/' + target;
189 if ( fileName.isNull() )
192 if ( sCopyingInfoMap()->contains( fileName ) )
194 QgsDebugMsgLevel(
"found copying info in copyingInfoMap, file = " + fileName, 2 );
195 return sCopyingInfoMap()->value( fileName );
202 if ( !f.open( QFile::ReadOnly ) )
209 QDomDocument doc( u
"license"_s );
210 if ( !doc.setContent( &f ) )
219 const QDomElement docElem = doc.documentElement();
220 if ( docElem.tagName() !=
"copying"_L1 )
227 const QDomElement authorsElement = docElem.firstChildElement( u
"authors"_s );
228 if ( authorsElement.isNull() )
234 QDomElement e = authorsElement.firstChildElement();
236 while ( ! e.isNull() )
238 if ( e.tagName() ==
"author"_L1 )
240 if ( ! e.firstChildElement( u
"name"_s ).isNull() )
241 authors << e.firstChildElement( u
"name"_s ).text().simplified();
244 e = e.nextSiblingElement();
246 copyingMap[ u
"authors"_s] = authors.join(
", "_L1 );
250 const QDomElement licenseElement = docElem.firstChildElement( u
"license"_s );
251 if ( licenseElement.isNull() )
257 QDomElement e = licenseElement.firstChildElement( u
"informal"_s );
259 copyingMap[ u
"license/informal"_s] = e.text().simplified();
260 e = licenseElement.firstChildElement( u
"year"_s );
262 copyingMap[ u
"license/year"_s] = e.text().simplified();
263 e = licenseElement.firstChildElement( u
"text"_s );
264 if ( ! e.isNull() && e.attribute( u
"href"_s ) != QString() )
265 copyingMap[ u
"license/url"_s] = e.attribute( u
"href"_s );
269 const QDomElement element = docElem.firstChildElement( u
"src"_s );
270 if ( element.isNull() )
276 const QDomElement e = element.firstChildElement( u
"link"_s );
277 if ( ! e.isNull() && e.attribute( u
"href"_s ) != QString() )
278 copyingMap[ u
"src/link"_s] = e.attribute( u
"href"_s );
282 ( *sCopyingInfoMap() )[ fileName ] = copyingMap;
293 if ( ! f.open( QFile::ReadOnly ) )
295 QgsDebugMsgLevel(
"description file " + fileName +
" ] does not exist", 2 );
301 QDomDocument doc( u
"description"_s );
302 if ( !doc.setContent( &f, &errMsg ) )
305 QgsDebugError(
"Couldn't parse file " + fileName +
" : " + errMsg );
311 const QDomElement docElem = doc.documentElement();
312 if ( docElem.tagName() !=
"description"_L1 )
319 QDomElement e = docElem.firstChildElement( u
"name"_s );
324 descMap[ u
"name"_s] = e.text().simplified();
325 e = docElem.firstChildElement( u
"full"_s );
330 descMap[ u
"full"_s] = e.text().simplified();
337 QMap< double, QPair<QColor, QColor> > colorMap;
341 if ( !f.open( QFile::ReadOnly ) )
348 QDomDocument doc( u
"gradient"_s );
349 if ( !doc.setContent( &f ) )
357 const QDomElement docElem = doc.documentElement();
359 if ( docElem.tagName() !=
"svg"_L1 )
366 QDomElement rampsElement = docElem.firstChildElement( u
"linearGradient"_s );
367 if ( rampsElement.isNull() )
369 const QDomNodeList nodeList = docElem.elementsByTagName( u
"linearGradient"_s );
370 if ( ! nodeList.isEmpty() )
371 rampsElement = nodeList.at( 0 ).toElement();
373 if ( rampsElement.isNull() )
380 QDomElement e = rampsElement.firstChildElement();
382 while ( !e.isNull() )
384 if ( e.tagName() ==
"stop"_L1 )
388 QString offsetStr = e.attribute( u
"offset"_s );
389 const QString colorStr = e.attribute( u
"stop-color"_s, QString() );
390 const QString opacityStr = e.attribute( u
"stop-opacity"_s, u
"1.0"_s );
391 if ( offsetStr.endsWith(
'%' ) )
392 offset = offsetStr.remove( offsetStr.size() - 1, 1 ).toDouble() / 100.0;
394 offset = offsetStr.toDouble();
397 if ( colorStr.isEmpty() )
400 color = QColor( 0, 0, 0 );
407 if ( color.isValid() )
409 const int alpha = opacityStr.toDouble() * 255;
410 color.setAlpha( alpha );
411 if ( colorMap.contains( offset ) )
412 colorMap[offset].second = color;
414 colorMap[offset] = qMakePair( color, color );
418 QgsDebugError( u
"at offset=%1 invalid color \"%2\""_s.arg( offset ).arg( colorStr ) );
426 e = e.nextSiblingElement();
434 return ( mRootItems.isEmpty() );
442 if ( sArchiveRegistry()->contains( *sDefaultArchiveName() ) )
443 return sArchiveRegistry()->value( *sDefaultArchiveName() );
461 const QString
baseDir = settings.
value( u
"CptCity/baseDir"_s,
466 if ( ! sArchiveRegistry()->contains( defArchiveName ) )
473 QString
baseDir, defArchiveName;
486 const QStringList fileList = dir.entryList( QStringList() << u
"cpt-city*"_s, QDir::Dirs );
487 for (
const QString &entry : fileList )
489 if ( QFile::exists(
baseDir +
'/' + entry +
"/VERSION.xml" ) )
490 archivesMap[ entry ] =
baseDir +
'/' + entry;
495 archivesMap[ defArchiveName ] =
baseDir +
'/' + defArchiveName;
498 for ( QgsStringMap::iterator it = archivesMap.begin();
499 it != archivesMap.end(); ++it )
501 if ( QDir( it.value() ).exists() )
505 QgsDebugError( u
"not loading archive [%1] because dir %2 does not exist "_s.arg( it.key(), it.value() ) );
508 *sDefaultArchiveName() = defArchiveName;
513 qDeleteAll( *sArchiveRegistry() );
514 sArchiveRegistry()->clear();
521 const QString &
name,
const QString &
path )
532 QVector<QgsCptCityDataItem *>
children;
543 QApplication::setOverrideCursor( Qt::WaitCursor );
546 const auto constChildren =
children;
554 QApplication::restoreOverrideCursor();
574 count += child->leafCount();
596 mChildren.at( i )->mName.localeAwareCompare( child->
mName ) >= 0 )
604 if (
mChildren.at( i )->mName.localeAwareCompare( child->
mName ) >= 0 )
625 const int i =
mChildren.indexOf( child );
636 const int i =
mChildren.indexOf( child );
651 for (
int i = 0; i < items.size(); i++ )
654 if ( items[i]->
equal( item ) )
664 QApplication::setOverrideCursor( Qt::WaitCursor );
669 QVector<QgsCptCityDataItem *> remove;
673 if (
findItem( items, child ) >= 0 )
675 remove.append( child );
677 const auto constRemove = remove;
684 const auto constItems = items;
696 QApplication::restoreOverrideCursor();
701 return ( metaObject()->className() == other->metaObject()->className() &&
708 const QString &
name,
const QString &
path,
const QString &variantName,
bool initialize )
720 const QString &
name,
const QString &
path,
const QStringList &variantList,
bool initialize )
723 ,
mRamp(
path, variantList, QString(), false )
741 QStringList variantList =
mRamp.variantList();
742 if (
mRamp.variantName().isNull() && ! variantList.isEmpty() )
743 mRamp.setVariantName( variantList[ variantList.count() / 2 ] );
748 if ( ! QFile::exists(
mRamp.fileName() ) )
754 if (
mRamp.count() > 0 )
756 if ( variantList.isEmpty() )
758 int count =
mRamp.count();
759 if (
mRamp.isDiscrete() )
761 mInfo = QString::number( count ) +
' ' + tr(
"colors" ) +
" - ";
762 if (
mRamp.isDiscrete() )
763 mInfo += tr(
"discrete" );
766 if ( !
mRamp.hasMultiStops() )
767 mInfo += tr(
"continuous" );
769 mInfo += tr(
"continuous (multi)" );
775 mInfo = QString::number( variantList.count() ) +
' ' + tr(
"variants" );
804 return icon( QSize( 100, 15 ) );
809 const auto constMIcons =
mIcons;
810 for (
const QIcon &
icon : constMIcons )
812 if (
icon.availableSizes().contains( size ) )
826 QPixmap blankPixmap( size );
827 blankPixmap.fill( Qt::white );
828 icon = QIcon( blankPixmap );
838 const QString &
name,
const QString &
path )
850 QVector< QgsCptCityDataItem * > rampItems;
851 QVector< QgsCptCityDataItem * > deleteItems;
856 const auto constChildren =
children();
861 QgsDebugMsgLevel( u
"child path= %1 coll= %2 ramp = %3"_s.arg( childItem->path() ).arg(
nullptr != collectionItem ).arg(
nullptr != rampItem ), 2 );
862 if ( collectionItem && recursive )
872 rampItems << rampItem;
874 deleteItems << rampItem;
883 const auto constDeleteItems = deleteItems;
886 QgsDebugError( u
"item %1 is invalid, will be deleted"_s.arg( deleteItem->path() ) );
887 const int i =
mChildren.indexOf( deleteItem );
898 const QString &
name,
const QString &
path )
912 mPath +
'/' +
"DESC.xml";
914 if ( descMap.contains( u
"name"_s ) )
915 mInfo = descMap.value( u
"name"_s );
923 return QVector<QgsCptCityDataItem *>();
925 QVector<QgsCptCityDataItem *>
children;
928 QMapIterator< QString, QStringList> it(
rampsMap() );
929 while ( it.hasNext() )
943 for (
const QString &childPath : constDirEntries )
961 QString curName, prevName, curVariant, curSep, schemeName;
962 QStringList listVariant;
963 QStringList schemeNamesAll, schemeNames;
964 bool prevAdd, curAdd;
967 schemeNamesAll = dir.entryList( QStringList( u
"*.svg"_s ), QDir::Files, QDir::Name );
970 for (
int i = 0; i < schemeNamesAll.count(); i++ )
973 schemeName = schemeNamesAll[i];
974 schemeName.chop( 4 );
976 curName = schemeName;
981 if ( schemeName.length() > 1 && schemeName.endsWith(
'a' ) && ! listVariant.isEmpty() &&
982 ( ( prevName + listVariant.last() +
'a' ) == curName ) )
985 curVariant = listVariant.last() +
'a';
989 const thread_local QRegularExpression rxVariant(
"^(.*[^\\d])(\\d{1,3})$" );
990 const QRegularExpressionMatch match = rxVariant.match( schemeName );
991 if ( match.hasMatch() )
993 curName = match.captured( 1 );
994 curVariant = match.captured( 2 );
998 curSep = curName.right( 1 );
999 if ( curSep ==
"-"_L1 || curSep ==
"_"_L1 )
1002 curVariant = curSep + curVariant;
1005 if ( prevName.isEmpty() )
1011 if ( curName.isEmpty() )
1012 curName = u
"__empty__"_s;
1014 if ( curName == prevName )
1017 if ( i == schemeNamesAll.count() - 1 )
1019 listVariant << curVariant;
1023 if ( !prevName.isEmpty() )
1028 if ( i == schemeNamesAll.count() - 1 )
1037 if ( listVariant.isEmpty() )
1041 schemeNames << prevName;
1044 else if ( listVariant.count() <= 3 )
1047 for (
int j = 0; j < listVariant.count(); j++ )
1050 schemeNames << prevName + listVariant[j];
1051 mRampsMap[
mPath +
'/' + prevName + listVariant[j] ] = QStringList();
1058 schemeNames << prevName;
1060 listVariant.clear();
1064 if ( !curVariant.isEmpty() )
1065 curName += curVariant;
1066 schemeNames << curName;
1070 if ( prevAdd || curAdd )
1073 if ( !curVariant.isEmpty() )
1074 listVariant << curVariant;
1081 mSchemeMap[
path ] = schemeNames;
1082 schemeCount += schemeName.count();
1083 schemeNames.clear();
1084 listVariant.clear();
1093 '/' +
mPath ).entryList( QDir::Dirs | QDir::NoDotAndDotDot, QDir::Name );
1103 return (
path() == other->
path() );
1107 const QString &
name,
const QString &
path )
1113 if ( dirItem && ! dirItem->
isValid() )
1158 const QString &
name,
const QString &
path )
1170 return QVector<QgsCptCityDataItem *>();
1173 QVector<QgsCptCityDataItem *>
children;
1180 QgsDebugMsgLevel(
"childPath = " + childPath +
" name= " + QFileInfo( childPath ).baseName(), 2 );
1181 if ( childPath.endsWith(
'/' ) )
1183 childPath.chop( 1 );
1197 if ( !QFile::exists( fileName ) )
1221 QFile f( filename );
1222 if ( ! f.open( QFile::ReadOnly ) )
1230 QDomDocument doc( u
"selection"_s );
1231 if ( !doc.setContent( &f, &errMsg ) )
1234 QgsDebugError(
"Couldn't parse file " + filename +
" : " + errMsg );
1240 const QDomElement docElem = doc.documentElement();
1241 if ( docElem.tagName() !=
"selection"_L1 )
1243 QgsDebugError(
"Incorrect root tag: " + docElem.tagName() );
1246 QDomElement e = docElem.firstChildElement( u
"name"_s );
1247 if ( ! e.isNull() && ! e.text().isNull() )
1249 mInfo = docElem.firstChildElement( u
"synopsis"_s ).text().simplified();
1252 const QDomElement collectsElem = docElem.firstChildElement( u
"seealsocollects"_s );
1253 e = collectsElem.firstChildElement( u
"collect"_s );
1254 while ( ! e.isNull() )
1256 if ( ! e.attribute( u
"dir"_s ).isNull() )
1259 const QString dir = e.attribute( u
"dir"_s ) +
'/';
1265 e = e.nextSiblingElement();
1268 const QDomElement gradientsElem = docElem.firstChildElement( u
"gradients"_s );
1269 e = gradientsElem.firstChildElement( u
"gradient"_s );
1270 while ( ! e.isNull() )
1272 if ( ! e.attribute( u
"dir"_s ).isNull() )
1276 const QString dir = e.attribute( u
"dir"_s );
1282 e = e.nextSiblingElement();
1293 return (
path() == other->
path() );
1298 const QString &
name,
const QVector<QgsCptCityDataItem *> &items )
1310 return QVector<QgsCptCityDataItem *>();
1312 QVector<QgsCptCityDataItem *>
children;
1315 const auto constMItems =
mItems;
1330 : QAbstractItemModel(
parent )
1335 QgsDebugMsgLevel(
"archiveName = "_L1 + archive->
archiveName() +
" viewType=" + QString::number(
static_cast< int >( viewType ) ), 2 );
1366 if ( !
index.isValid() )
1367 return Qt::ItemFlags();
1369 Qt::ItemFlags
flags = Qt::ItemIsEnabled | Qt::ItemIsSelectable;
1376 if ( !
index.isValid() )
1385 else if ( role == Qt::DisplayRole )
1387 if (
index.column() == 0 )
1388 return item->
name();
1389 if (
index.column() == 1 )
1391 return item->
info();
1394 else if ( role == Qt::ToolTipRole )
1398 return QString( item->
path() +
'\n' + item->
info() );
1401 else if ( role == Qt::DecorationRole &&
index.column() == 1 &&
1407 else if ( role == Qt::FontRole &&
1408 qobject_cast< QgsCptCityCollectionItem * >( item ) )
1412 font.setPointSize( 11 );
1413 font.setBold(
true );
1427 if ( orientation == Qt::Horizontal && role == Qt::DisplayRole )
1430 return QVariant( tr(
"Name" ) );
1431 else if ( section == 1 )
1432 return QVariant( tr(
"Info" ) );
1450 return item ? item->
rowCount() : 0;
1472 QModelIndex rootIndex;
1473 bool foundParent =
false, foundChild =
true;
1479 if ( path.isEmpty() )
1481 for (
int i = 0; i <
rowCount( rootIndex ); i++ )
1483 QModelIndex idx =
index( i, 0, rootIndex );
1486 return QModelIndex();
1488 itemPath = item->
path();
1490 if ( itemPath == path )
1498 while ( foundChild )
1504 if ( itemPath.isEmpty() )
1506 for ( ; i <
rowCount( rootIndex ); i++ )
1508 QModelIndex idx =
index( i, 0, rootIndex );
1511 return QModelIndex();
1513 itemPath = item->
path();
1515 if ( itemPath == path )
1521 if ( ! itemPath.endsWith(
'/' ) )
1524 foundParent =
false;
1535 for ( QString childPath : constSelectionsList )
1537 if ( childPath.endsWith(
'/' ) )
1538 childPath.chop( 1 );
1540 if ( path.startsWith( childPath ) )
1549 else if ( path.startsWith( itemPath ) )
1567 return QModelIndex();
1581 const QModelIndex idx =
findPath( path );
1582 if ( idx.isValid() )
1595 return item ? createIndex( row, column, item ) : QModelIndex();
1602 return QModelIndex();
1611 for (
int i = 0; i < items.size(); i++ )
1613 if ( items[i] == item )
1614 return createIndex( i, 0, item );
1616 QModelIndex childIndex =
findItem( item, items[i] );
1617 if ( childIndex.isValid() )
1621 return QModelIndex();
1639 if ( !idx.isValid() )
1642 beginInsertRows( idx, first, last );
1653 if ( !idx.isValid() )
1655 beginRemoveRows( idx, first, last );
1699 void *v = idx.internalPointer();
1701 Q_ASSERT( !v || d );
static QString pkgDataPath()
Returns the common root path of all application data directories.
An "All ramps item", which contains all items in a flat hierarchy.
QgsCptCityAllRampsItem(QgsCptCityDataItem *parent, const QString &name, const QVector< QgsCptCityDataItem * > &items)
QVector< QgsCptCityDataItem * > mItems
QVector< QgsCptCityDataItem * > createChildren() override
Returns a vector of children items.
Represents a CPT City color scheme.
static void clearArchives()
static void initArchive(const QString &archiveName, const QString &archiveBaseDir)
QString descFileName(const QString &dirName) const
static QString defaultBaseDir()
static QMap< QString, QString > copyingInfo(const QString &fileName)
QString archiveName() const
static QgsCptCityArchive * defaultArchive()
QString copyingFileName(const QString &dirName) const
bool isEmpty() const
Returns true if archive is empty.
static void initDefaultArchive()
QgsCptCityArchive(const QString &archiveName=DEFAULT_CPTCITY_ARCHIVE, const QString &baseDir=QString())
static QString findFileName(const QString &target, const QString &startDir, const QString &baseDir)
static QMap< QString, QString > description(const QString &fileName)
static void initArchives(bool loadAll=false)
static QMap< QString, QgsCptCityArchive * > archiveRegistry()
static QMap< double, QPair< QColor, QColor > > gradientColorMap(const QString &fileName)
int columnCount(const QModelIndex &parent=QModelIndex()) const override
void refresh(const QString &path)
Refresh the item specified by path.
void beginRemoveItems(QgsCptCityDataItem *parent, int first, int last)
QModelIndex findPath(const QString &path)
Returns index of a path.
QVariant data(const QModelIndex &index, int role=Qt::DisplayRole) const override
QModelIndex index(int row, int column, const QModelIndex &parent=QModelIndex()) const override
QgsCptCityDataItem * dataItem(const QModelIndex &idx) const
Returns the data item corresponding to the given index.
void reload()
Reload the whole model.
void connectItem(QgsCptCityDataItem *item)
QgsCptCityArchive * mArchive
QModelIndex parent(const QModelIndex &index) const override
Qt::ItemFlags flags(const QModelIndex &index) const override
QVariant headerData(int section, Qt::Orientation orientation, int role=Qt::DisplayRole) const override
QgsCptCityBrowserModel(QObject *parent=nullptr, QgsCptCityArchive *archive=QgsCptCityArchive::defaultArchive(), ViewType Type=Authors)
void beginInsertItems(QgsCptCityDataItem *parent, int first, int last)
void fetchMore(const QModelIndex &parent) override
int rowCount(const QModelIndex &parent=QModelIndex()) const override
~QgsCptCityBrowserModel() override
bool hasChildren(const QModelIndex &parent=QModelIndex()) const override
bool canFetchMore(const QModelIndex &parent) const override
QModelIndex findItem(QgsCptCityDataItem *item, QgsCptCityDataItem *parent=nullptr) const
QVector< QgsCptCityDataItem * > mRootItems
~QgsCptCityCollectionItem() override
QgsCptCityCollectionItem(QgsCptCityDataItem *parent, const QString &name, const QString &path)
QVector< QgsCptCityDataItem * > childrenRamps(bool recursive)
An item that represents a layer that can be opened with one of the providers for a QgsCptCityBrowserM...
const QgsCptCityColorRamp & ramp() const
bool equal(const QgsCptCityDataItem *other) override
Returns true if this item is equal to an other item.
QgsCptCityColorRampItem(QgsCptCityDataItem *parent, const QString &name, const QString &path, const QString &variantName=QString(), bool initialize=false)
QgsCptCityColorRamp mRamp
static QString fileNameForVariant(const QString &schema, const QString &variant)
Returns the source file name for a CPT schema and variant.
QString variantName() const
Base class for all items in a QgsCptCityBrowserModel model.
QgsCptCityDataItem * parent() const
virtual void addChildItem(QgsCptCityDataItem *child, bool refresh=false)
Inserts a new child using alphabetical order based on mName, emits necessary signal to model before a...
void beginRemoveItems(QgsCptCityDataItem *parent, int first, int last)
Emitted before child items are removed from this data item.
virtual QVector< QgsCptCityDataItem * > createChildren()
Returns a vector of children items.
virtual QgsCptCityDataItem * removeChildItem(QgsCptCityDataItem *child)
Removes a child item but doesn't delete it, signals to browser are emitted.
void endRemoveItems()
Emitted after child items have been removed from this data item.
bool isPopulated()
Returns true if the item is already populated.
static int findItem(QVector< QgsCptCityDataItem * > items, QgsCptCityDataItem *item)
Finds a child index in vector of items using '==' operator.
QVector< QgsCptCityDataItem * > mChildren
void endInsertItems()
Emitted after child items have been added to this data item.
void setParent(QgsCptCityDataItem *parent)
virtual void populate()
Populates children using children vector created by createChildren().
virtual void deleteChildItem(QgsCptCityDataItem *child)
Removes and deletes a child item, signals to browser are emitted.
virtual bool equal(const QgsCptCityDataItem *other)
Returns true if this item is equal to an other item.
QgsCptCityDataItem * mParent
QgsCptCityDataItem(QgsCptCityDataItem::Type type, QgsCptCityDataItem *parent, const QString &name, const QString &path)
QVector< QgsCptCityDataItem * > children() const
void beginInsertItems(QgsCptCityDataItem *parent, int first, int last)
Emitted before child items are added to this item.
virtual int leafCount() const
Returns the total count of "leaf" items (all children which are end nodes).
A directory which contains subdirectories and color ramps for use in QgsCptCityBrowserModel.
QStringList dirEntries() const
static QgsCptCityDataItem * dataItem(QgsCptCityDataItem *parent, const QString &name, const QString &path)
QVector< QgsCptCityDataItem * > createChildren() override
Returns a vector of children items.
QgsCptCityDirectoryItem(QgsCptCityDataItem *parent, const QString &name, const QString &path)
QMap< QString, QStringList > mRampsMap
bool equal(const QgsCptCityDataItem *other) override
Returns true if this item is equal to an other item.
QMap< QString, QStringList > rampsMap()
A selection which contains subdirectories and color ramps for use in QgsCptCityBrowserModel.
QVector< QgsCptCityDataItem * > createChildren() override
Returns a vector of children items.
QgsCptCitySelectionItem(QgsCptCityDataItem *parent, const QString &name, const QString &path)
bool equal(const QgsCptCityDataItem *other) override
Returns true if this item is equal to an other item.
QStringList mSelectionsList
QStringList selectionsList() const
Stores settings for use within QGIS.
QVariant value(const QString &key, const QVariant &defaultValue=QVariant(), Section section=NoSection) const
Returns the value for setting key.
static QColor parseColor(const QString &colorStr, bool strictEval=false)
Attempts to parse a string as a color using a variety of common formats, including hex codes,...
static QIcon colorRampPreviewIcon(QgsColorRamp *ramp, QSize size, int padding=0)
Returns an icon preview for a color ramp.
QMap< QString, QString > QgsStringMap
QMap< QString, QMap< QString, QString > > CopyingInfoMap
QMap< QString, QgsCptCityArchive * > ArchiveRegistry
#define DEFAULT_CPTCITY_ARCHIVE
Q_GLOBAL_STATIC(QReadWriteLock, sDefinitionCacheLock)
#define QgsDebugMsgLevel(str, level)
#define QgsDebugError(str)