All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
PropertyItem.cpp
Go to the documentation of this file.
1 /* Copyright (C) 2008 National Institute For Space Research (INPE) - Brazil.
2 
3  This file is part of the TerraLib - a Framework for building GIS enabled applications.
4 
5  TerraLib is free software: you can redistribute it and/or modify
6  it under the terms of the GNU Lesser General Public License as published by
7  the Free Software Foundation, either version 3 of the License,
8  or (at your option) any later version.
9 
10  TerraLib is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  GNU Lesser General Public License for more details.
14 
15  You should have received a copy of the GNU Lesser General Public License
16  along with TerraLib. See COPYING. If not, write to
17  TerraLib Team at <terralib-team@terralib.org>.
18  */
19 
20 /*!
21  \file terralib/qt/widgets/datasource/explorer/PropertyItem.cpp
22 
23  \brief A class that represents a dataset in a TreeModel.
24 */
25 
26 // TerraLib
27 #include "../../../../common/Translator.h"
28 #include "../../../../datatype/Property.h"
29 #include "../../Exception.h"
30 #include "PropertyGroupItem.h"
31 #include "PropertyItem.h"
32 
33 // Qt
34 #include <QMenu>
35 #include <QWidget>
36 
39  m_property(p)
40 {
41 }
42 
44 {
45  //if(m_property && (m_property->getParent() == 0))
46  // delete m_property;
47 }
48 
50 {
51  return 1;
52 }
53 
54 QVariant te::qt::widgets::PropertyItem::data(int /*column*/, int role) const
55 {
56  if(role == Qt::DecorationRole)
57  return QVariant(QIcon::fromTheme("property"));
58 
59  if(role == Qt::DisplayRole)
60  return QVariant(m_property->getName().c_str());
61 
62  return QVariant();
63 }
64 
65 QMenu* te::qt::widgets::PropertyItem::getMenu(QWidget* parent) const
66 {
67  QMenu* m = new QMenu(parent);
68 
69  QAction* aOpenProperty = m->addAction(tr("&Open property"));
70 
71  connect(aOpenProperty, SIGNAL(triggered()), this, SLOT(openProperty()));
72 
73  return m;
74 }
75 
77 {
78  return false;
79 }
80 
82 {
83  return Qt::NoItemFlags;
84 }
85 
87 {
88 }
89 
91 {
92  return false;
93 }
94 
95 bool te::qt::widgets::PropertyItem::setData(const QVariant& /*value*/, int /*role*/)
96 {
97  return false;
98 }
99 
101 {
102  return m_property;
103 }
QMenu * getMenu(QWidget *parent=0) const
Qt::ItemFlags flags() const
It models a property definition.
Definition: Property.h:59
A class used to group a set of properties from a dataset in a TreeModel.
te::dt::Property * getProperty() const
bool setData(const QVariant &value, int role=Qt::EditRole)
QVariant data(int column, int role) const
PropertyItem(te::dt::Property *p, AbstractDataSourceTreeItem *parent)
Constructor.
A class that represents a dataset in a TreeModel.