27 #include "../../../../maptools/FolderLayer.h"
28 #include "../../../../common/Translator.h"
29 #include "../../Exception.h"
54 if(role == Qt::DecorationRole)
55 return QVariant(QIcon::fromTheme(
"folder"));
57 if(role == Qt::DisplayRole)
58 return QVariant(QString::fromStdString(m_layer->getTitle()));
60 if(role == Qt::CheckStateRole)
63 return QVariant(Qt::Checked);
65 return QVariant(Qt::Unchecked);
67 return QVariant(Qt::PartiallyChecked);
87 return m_layer->hasChildren() && children().empty();
92 return Qt::ItemIsUserCheckable | Qt::ItemIsDragEnabled | Qt::ItemIsDropEnabled;
97 if(!children().empty())
108 return m_layer->hasChildren();
113 if(role == Qt::CheckStateRole)
115 Qt::CheckState checkState =
static_cast<Qt::CheckState
>(value.toInt());
116 if(checkState == Qt::Checked)
118 else if(checkState == Qt::Unchecked)
121 m_layer->updateVisibilityOfAncestors();
136 return "FOLDER_LAYER_ITEM";
The class that represents a folder layer item in a LayerTreeModel.
A layer that can be used as a container for other kind of layers.
A class for building layer items.
boost::intrusive_ptr< AbstractLayer > AbstractLayerPtr
std::list< TreeItemPtr >::const_iterator const_iterator