Loading...
Searching...
No Matches
LayerViewDelegate.h
Go to the documentation of this file.
1/* Copyright (C) 2008 National Institute For Space Research (INPE) - Brazil.
2
3This file is part of the TerraLib - a Framework for building GIS enabled applications.
4
5TerraLib is free software: you can redistribute it and/or modify
6it under the terms of the GNU Lesser General Public License as published by
7the Free Software Foundation, either version 3 of the License,
8or (at your option) any later version.
9
10TerraLib is distributed in the hope that it will be useful,
11but WITHOUT ANY WARRANTY; without even the implied warranty of
12MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13GNU Lesser General Public License for more details.
14
15You should have received a copy of the GNU Lesser General Public License
16along with TerraLib. See COPYING. If not, write to
17TerraLib Team at <terralib-team@terralib.org>.
18*/
19
20/*!
21 * \file LayerViewDelegate.h
22 *
23 * \brief A class for rendering icons for layer and folder itens.
24 */
25#ifndef __TERRALIB_QT_WIDGETS_LAYER_INTERNAL_LAYERVIEWDELEGATE_H
26#define __TERRALIB_QT_WIDGETS_LAYER_INTERNAL_LAYERVIEWDELEGATE_H
27
28#include "../../Config.h"
29
30// TerraLib
31#include "../../../../common/Decorator.h"
32
33// Qt
34#include <QIcon>
35#include <QStyledItemDelegate>
36
37namespace te
38{
39 namespace qt
40 {
41 namespace widgets
42 {
43 /*!
44 * \class LayerViewDelegate
45 *
46 * \brief A class for rendering icons for layer and folder itens.
47 *
48 * This is the default delegate for LayerItemView. It's used for present icons for the known kind of items.
49 * For unknown items, or if you want to change the known ones, you can create your own delegate and install
50 * it on the LayerItemView. Note that we use a decorator instead the QStyledItemDelegate. This is useful for
51 * making the inheritance dynamic.
52 *
53 * \ingroup widgets
54 *
55 * \sa te::common::Decorator
56 */
58 {
59 Q_OBJECT
60
61 public:
62
63 /*!
64 * \name Instantiation Methods
65 *
66 * Methods related to creation and destruction of the object.
67 */
68 //@{
69
70 /*!
71 * \brief Constructor.
72 *
73 * \param decorated The delegate to be decorated.
74 *
75 * \param parent Used by Qt5.
76 */
77 LayerViewDelegate(QStyledItemDelegate* decorated, QObject* parent = 0);
78
79 /*!
80 * \brief Destructor.
81 */
83
84 /*!
85 * \name Reimplementation of QStyledItemDelegate.
86 *
87 * Methods reimplemented of the QStyledItemDelegate class.
88 */
89 //@{
90 void paint(QPainter * painter, const QStyleOptionViewItem & option, const QModelIndex & index) const;
91 //@}
92
93 protected:
94
95 /*!
96 * \brief Returns the icon for a given index.
97 *
98 * \param index Index of the object being rendered.
99 *
100 * \return The icon for the \a index.
101 */
102 QIcon getIcon(const QModelIndex & index) const;
103
104 QIcon m_layer; //!< Icon for a layer not invalid.
105 QIcon m_folder; //!< Icon for a folder.
106 QIcon m_style; //!< Icon for a style.
107 QIcon m_colorMap; //!< Icon for a ColorMap.
108 QIcon m_chart; //!< Icon for a chart.
109 QIcon m_queryLayer; //!< Icon for a query layer.
110 QIcon m_tabularLayer; //!< Icon for a tabular layer.
111 QIcon m_invalidLayer; //!< Icon for an invalid layers.
112 QIcon m_warningLayer; //!< Icon for a layer with warnings.
113 };
114 }
115 }
116}
117
118#endif //__TERRALIB_QT_WIDGETS_LAYER_INTERNAL_LAYERVIEWDELEGATE_H
A class for rendering icons for layer and folder itens.
QIcon m_tabularLayer
Icon for a tabular layer.
QIcon m_colorMap
Icon for a ColorMap.
QIcon m_queryLayer
Icon for a query layer.
QIcon getIcon(const QModelIndex &index) const
Returns the icon for a given index.
QIcon m_layer
Icon for a layer not invalid.
void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const
QIcon m_invalidLayer
Icon for an invalid layers.
LayerViewDelegate(QStyledItemDelegate *decorated, QObject *parent=0)
Constructor.
QIcon m_warningLayer
Icon for a layer with warnings.
TerraLib.
#define TEQTWIDGETSEXPORT
You can use this macro in order to export/import classes and functions from this module.
Definition: Config.h:63