All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
CheckConstraintItem.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/CheckConstraintItem.cpp
22 
23  \brief A class that represents a check-constraint in a TreeModel.
24 */
25 
26 // TerraLib
27 #include "../../../../common/Translator.h"
28 #include "../../../../dataaccess/dataset/CheckConstraint.h"
29 #include "../../Exception.h"
30 #include "CheckConstraintItem.h"
31 
32 // Qt
33 #include <QMenu>
34 #include <QWidget>
35 
38  m_cc(cc)
39 {
40 }
41 
43 {
44  //if((m_cc != 0) && (m_cc->getDataSetType() != 0))
45  // delete m_cc;
46 }
47 
49 {
50  return 1;
51 }
52 
53 QVariant te::qt::widgets::CheckConstraintItem::data(int /*column*/, int role) const
54 {
55  if(role == Qt::DecorationRole)
56  return QVariant(QIcon::fromTheme("check"));
57 
58  if(role == Qt::DisplayRole)
59  return QVariant(m_cc->getName().c_str());
60 
61  return QVariant();
62 }
63 
64 QMenu* te::qt::widgets::CheckConstraintItem::getMenu(QWidget* parent) const
65 {
66  QMenu* m = new QMenu(parent);
67 
68  QAction* aOpenCheckConstraint = m->addAction(tr("&Open check-constraint"));
69 
70  connect(aOpenCheckConstraint, SIGNAL(triggered()), this, SLOT(openCheckConstraint()));
71 
72  return m;
73 }
74 
76 {
77  return false;
78 }
79 
81 {
82  return Qt::NoItemFlags;
83 }
84 
86 {
87 }
88 
90 {
91  return false;
92 }
93 
94 bool te::qt::widgets::CheckConstraintItem::setData(const QVariant& /*value*/, int /*role*/)
95 {
96  return false;
97 }
98 
100 {
101  return m_cc;
102 }
103 
QMenu * getMenu(QWidget *parent=0) const
QVariant data(int column, int role) const
A class that describes a check constraint.
A class that represents a check-constraint in a TreeModel.
bool setData(const QVariant &value, int role=Qt::EditRole)
te::da::CheckConstraint * getCheckConstraint() const
CheckConstraintItem(te::da::CheckConstraint *cc, AbstractDataSourceTreeItem *parent)
Constructor.