27 #include "../../../../common/Translator.h"
28 #include "../../../../maptools/QueryLayer.h"
29 #include "../../../../se/Style.h"
30 #include "../../Exception.h"
38 #include <QtGui/QMenu>
39 #include <QtGui/QWidget>
61 if(role == Qt::DisplayRole)
62 return QVariant(QString::fromUtf8(m_layer->getTitle().c_str()));
64 if(role == Qt::CheckStateRole)
65 return QVariant(m_layer->getVisibility() ==
te::map::VISIBLE ? Qt::Checked : Qt::Unchecked);
84 return (m_layer->getStyle() != 0) && (m_layer->getStyle()->getRules().empty() ==
false) && children().isEmpty();
89 return Qt::ItemIsUserCheckable | Qt::ItemIsDragEnabled | Qt::ItemIsDropEnabled;;
94 if(!children().isEmpty())
97 if(m_layer->getStyle())
99 const std::vector<te::se::Rule*>& rules = m_layer->getStyle()->getRules();
101 for(std::size_t i = 0; i != rules.size(); ++i)
108 return (m_layer->getStyle() != 0) && (m_layer->getStyle()->getRules().empty() ==
false);
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 "QUERY_LAYER_ITEM";
te::map::QueryLayerPtr m_layer
Qt::ItemFlags flags() const
bool setData(int column, const QVariant &value, int role=Qt::EditRole)
A class that represents a legend item of a layer in a LayerTreeModel.
QMenu * getMenu(QWidget *parent=0) const
QVariant data(int column, int role) const
const std::string getItemType() const
It returns the item type: "QUERY_LAYER_ITEM".
te::map::AbstractLayerPtr getLayer() const
A layer resulting from a query.
The class that represents a query layer item in a LayerTreeModel.
The class that represents an item in a LayerTreeModel.
QueryLayerItem(const te::map::AbstractLayerPtr &l, QObject *parent=0)
boost::intrusive_ptr< AbstractLayer > AbstractLayerPtr
bool canFetchMore() const