27 #include "../../../../maptools/FolderLayer.h"
28 #include "../../../../common/Translator.h"
29 #include "../../Exception.h"
34 #include <QtGui/QMenu>
35 #include <QtGui/QWidget>
54 if(role == Qt::DecorationRole)
55 return QVariant(QIcon::fromTheme(
"folder"));
57 if(role == Qt::DisplayRole)
58 return QVariant(QString::fromUtf8(m_layer->getTitle().c_str()));
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";
te::map::FolderLayerPtr m_layer
te::map::AbstractLayerPtr getLayer() const
FolderLayerItem(const te::map::AbstractLayerPtr &l, QObject *parent=0)
A layer that can be used as a container for other kind of layers.
bool setData(int column, const QVariant &value, int role=Qt::EditRole)
std::list< TreeItemPtr >::const_iterator const_iterator
QMenu * getMenu(QWidget *parent=0) const
A class for building layer items.
static AbstractTreeItem * make(const te::map::AbstractLayerPtr &layer, QObject *parent)
const std::string getItemType() const
It returns the item type: "FOLDER_LAYER_ITEM".
QVariant data(int column, int role) const
The class that represents an item in a LayerTreeModel.
The class that represents a folder layer item in a LayerTreeModel.
bool canFetchMore() const
boost::intrusive_ptr< AbstractLayer > AbstractLayerPtr
Qt::ItemFlags flags() const