Main Page
Modules
Namespaces
Classes
Files
File List
File Members
MenuBarModel.h
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 MenuBarModel.h
22
23
\brief Contains a definition for a model over the QMenuBar.
24
*/
25
#ifndef __TERRALIB_QT_WIDGETS_INTERNAL_MENUBARMODEL_H
26
#define __TERRALIB_QT_WIDGETS_INTERNAL_MENUBARMODEL_H
27
28
#include <QtCore/QAbstractTableModel>
29
30
//Forward declaration
31
class
QMenuBar;
32
class
QToolBar;
33
class
QAction;
34
35
//STL
36
#include <vector>
37
38
namespace
te
39
{
40
namespace
qt
41
{
42
namespace
af
43
{
44
45
/*!
46
\class MenuBarModel
47
48
\brief Defines a model, based on a QMenuBar, to present all system buttons as a table.
49
*/
50
class
MenuBarModel
:
public
QAbstractTableModel
51
{
52
Q_OBJECT
53
54
public
:
55
56
/*!
57
\brief Constructor.
58
59
\param mnuBar The menu bar to be used.
60
61
\param parent Parent object.
62
*/
63
MenuBarModel
(QMenuBar* mnuBar,
QObject
* parent=0);
64
65
/*!
66
\brief Destructor.
67
*/
68
~MenuBarModel
();
69
70
virtual
Qt::ItemFlags
flags
(
const
QModelIndex & index)
const
;
71
72
QVariant
data
(
const
QModelIndex & index,
int
role = Qt::DisplayRole)
const
;
73
74
QVariant
headerData
(
int
section, Qt::Orientation orientation,
int
role = Qt::DisplayRole)
const
;
75
76
int
columnCount
(
const
QModelIndex & parent = QModelIndex())
const
;
77
78
int
rowCount
(
const
QModelIndex & parent = QModelIndex())
const
;
79
80
bool
setData
(
const
QModelIndex & index,
const
QVariant & value,
int
role = Qt::EditRole);
81
82
/*!
83
\brief Check the actions contained in \a acts.
84
85
\param acts List of the actions.
86
*/
87
void
updateActionsState
(
const
QList<QAction*>& acts);
88
89
/*!
90
\brief Sets the menu bar to be used in the model.
91
*/
92
void
setMenuBar
(QMenuBar* mnuBar);
93
94
signals:
95
96
void
updateAction
(QAction*,
const
bool
&);
97
98
protected
:
99
100
std::vector<QAction*>
m_actions
;
//!< System buttons.
101
std::vector<bool>
m_actionsActivation
;
//!< State of each system button. (True insert, False do nothing).
102
};
103
}
104
}
105
}
106
107
#endif //__TERRALIB_QT_WIDGETS_INTERNAL_MENUBARMODEL_H
te::qt::af::MenuBarModel::m_actions
std::vector< QAction * > m_actions
System buttons.
Definition:
MenuBarModel.h:100
te::qt::af::MenuBarModel::headerData
QVariant headerData(int section, Qt::Orientation orientation, int role=Qt::DisplayRole) const
Definition:
MenuBarModel.cpp:67
te::qt::af::MenuBarModel::MenuBarModel
MenuBarModel(QMenuBar *mnuBar, QObject *parent=0)
Constructor.
Definition:
MenuBarModel.cpp:19
te::qt::af::MenuBarModel::rowCount
int rowCount(const QModelIndex &parent=QModelIndex()) const
Definition:
MenuBarModel.cpp:79
te::qt::af::MenuBarModel::updateAction
void updateAction(QAction *, const bool &)
te::qt::af::MenuBarModel::~MenuBarModel
~MenuBarModel()
Destructor.
QObject
te::qt::af::MenuBarModel::setMenuBar
void setMenuBar(QMenuBar *mnuBar)
Sets the menu bar to be used in the model.
Definition:
MenuBarModel.cpp:124
te::qt::af::MenuBarModel::m_actionsActivation
std::vector< bool > m_actionsActivation
State of each system button. (True insert, False do nothing).
Definition:
MenuBarModel.h:101
te::qt::af::MenuBarModel::setData
bool setData(const QModelIndex &index, const QVariant &value, int role=Qt::EditRole)
Definition:
MenuBarModel.cpp:84
te
URI C++ Library.
Definition:
Attributes.h:37
te::qt::af::MenuBarModel
Defines a model, based on a QMenuBar, to present all system buttons as a table.
Definition:
MenuBarModel.h:50
te::qt::af::MenuBarModel::data
QVariant data(const QModelIndex &index, int role=Qt::DisplayRole) const
Definition:
MenuBarModel.cpp:33
te::qt::af::MenuBarModel::flags
virtual Qt::ItemFlags flags(const QModelIndex &index) const
Definition:
MenuBarModel.cpp:27
te::qt::af::MenuBarModel::updateActionsState
void updateActionsState(const QList< QAction * > &acts)
Check the actions contained in acts.
Definition:
MenuBarModel.cpp:102
te::qt::af::MenuBarModel::columnCount
int columnCount(const QModelIndex &parent=QModelIndex()) const
Definition:
MenuBarModel.cpp:74
QAbstractTableModel
terralib5_src
src
terralib
qt
af
settings
MenuBarModel.h
Generated on Wed Jun 6 2018 12:16:10 for TerraLib by
1.8.11