27 #include "../../../../common/Translator.h"
28 #include "../../../../se/Description.h"
29 #include "../../../../se/Rule.h"
30 #include "../../se/SymbologyPreview.h"
31 #include "../../Exception.h"
35 #include <QtGui/QMenu>
36 #include <QtGui/QPixmap>
37 #include <QtGui/QWidget>
58 if(role == Qt::DecorationRole && column == 0)
63 if(role == Qt::DisplayRole)
67 if(m_rule->getDescription())
68 return QVariant(QString::fromStdString(m_rule->getDescription()->getTitle()));
71 return QVariant(QString::fromStdString(*(m_rule->getName())));
73 return QVariant(QString(tr(
"Style")));
77 if(role == Qt::CheckStateRole && m_isCheckable && column == 0)
78 return QVariant(m_isChecked ? Qt::Checked : Qt::Unchecked);
105 return (m_isCheckable ? (Qt::ItemIsEnabled | Qt::ItemIsUserCheckable) : Qt::ItemIsEnabled);
119 if(role == Qt::CheckStateRole && m_isCheckable)
122 Qt::CheckState checkState =
static_cast<Qt::CheckState
>(value.toInt(&ok));
127 m_isChecked = (checkState == Qt::Checked ?
true :
false);
148 return "LEGEND_ITEM";
158 m_isCheckable = checkable;
163 return m_isCheckable;
static QPixmap build(const te::se::Symbolizer *symb, const QSize &size)
Generates the preview of given symbolizer element.
QVariant data(int column, int role) const
Qt::ItemFlags flags() const
LegendItem(const te::se::Rule *rule, QObject *parent=0)
A class that represents a legend item of a layer in a LayerTreeModel.
A Rule is used to attach property/scale conditions to and group the individual symbols used for rende...
bool canFetchMore() const
const std::string getItemType() const
It returns the item type: "LEGEND_ITEM".
QMenu * getMenu(QWidget *parent=0) const
The class that represents an item in a LayerTreeModel.
void setCheckable(bool checkable)
boost::intrusive_ptr< AbstractLayer > AbstractLayerPtr
bool setData(int column, const QVariant &value, int role=Qt::EditRole)
te::map::AbstractLayerPtr getLayer() const