Developer Documentation

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
PropertyModel.hh
1 /*===========================================================================*\
2 * *
3 * OpenFlipper *
4 * Copyright (c) 2001-2015, RWTH-Aachen University *
5 * Department of Computer Graphics and Multimedia *
6 * All rights reserved. *
7 * www.openflipper.org *
8 * *
9 *---------------------------------------------------------------------------*
10 * This file is part of OpenFlipper. *
11 *---------------------------------------------------------------------------*
12 * *
13 * Redistribution and use in source and binary forms, with or without *
14 * modification, are permitted provided that the following conditions *
15 * are met: *
16 * *
17 * 1. Redistributions of source code must retain the above copyright notice, *
18 * this list of conditions and the following disclaimer. *
19 * *
20 * 2. Redistributions in binary form must reproduce the above copyright *
21 * notice, this list of conditions and the following disclaimer in the *
22 * documentation and/or other materials provided with the distribution. *
23 * *
24 * 3. Neither the name of the copyright holder nor the names of its *
25 * contributors may be used to endorse or promote products derived from *
26 * this software without specific prior written permission. *
27 * *
28 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS *
29 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED *
30 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A *
31 * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER *
32 * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, *
33 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, *
34 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR *
35 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF *
36 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING *
37 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS *
38 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *
39 * *
40 \*===========================================================================*/
41
42 /*===========================================================================*\
43 * *
44 * $Revision$ *
45 * $LastChangedBy$ *
46 * $Date$ *
47 * *
48 \*===========================================================================*/
49
50 #ifndef PROPERTY_MODEL_H
51 #define PROPERTY_MODEL_H
52
53 #include "Utils.hh"
54 #include <QAbstractListModel>
55
56 class QMouseEvent;
57 class PropertyVisualizer;
58
59 class PropertyModel: public QAbstractListModel
60 {
61 Q_OBJECT
62
63 public:
64 virtual void pickModeChanged(const std::string& _mode) {}
65 virtual void mouseEvent(QMouseEvent* _event) {}
66
67 PropertyModel(QObject *parent = 0) : QAbstractListModel(parent) {}
68 virtual ~PropertyModel() {}
69
70 virtual int rowCount(const QModelIndex & parent = QModelIndex()) const = 0;
71 virtual QVariant data(const QModelIndex & index, int role = Qt::DisplayRole) const = 0;
72 virtual QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const = 0;
73
75 virtual void objectUpdated() = 0;
76
78 virtual void visualize(QModelIndexList selectedIndices, QWidgetList widgets = QWidgetList()) = 0;
79
81 virtual void removeProperty(QModelIndexList selectedIndices) = 0;
82
84 virtual void duplicateProperty(QModelIndexList selectedIndices) = 0;
85
87 virtual void gatherProperties() = 0;
88
90 virtual void clear(QModelIndexList selectedIndices) = 0;
91
93 virtual void hideWidget() = 0;
94
96 virtual QWidget* getWidget() = 0;
97
99 virtual void updateWidget(const QModelIndexList& selectedIndices) = 0;
100
102 virtual void connectLogs(PropertyVisualizer* propViz) = 0;
103
105 virtual PropertyInfo getPropertyInfo(const QModelIndex index) const = 0;
106
108 QModelIndex indexFromFancyPropName(const QString& propName) const;
109
111 QModelIndex indexFromPlainPropName(const QString& propName) const;
112 };
113
114 #endif /* PROPERTY_MODEL_H */
PropertyVisualizer
This class vizualizes a property.
Definition: PropertyVisualizer.hh:80
PropertyModel
Definition: PropertyModel.hh:59
PropertyModel::removeProperty
virtual void removeProperty(QModelIndexList selectedIndices)=0
Removes the selected properties.
PropertyModel::duplicateProperty
virtual void duplicateProperty(QModelIndexList selectedIndices)=0
Duplicates the selected properties.
PropertyModel::getPropertyInfo
virtual PropertyInfo getPropertyInfo(const QModelIndex index) const =0
Returns the property info for the property with the given index.
PropertyModel::connectLogs
virtual void connectLogs(PropertyVisualizer *propViz)=0
Connects the PropertyVisualizer log signals with the log slot.
PropertyModel::getWidget
virtual QWidget * getWidget()=0
Returns the widget.
PropertyModel::clear
virtual void clear(QModelIndexList selectedIndices)=0
Clears the selected property visualization.
PropertyModel::indexFromPlainPropName
QModelIndex indexFromPlainPropName(const QString &propName) const
Returns the index of the property with the given name.
Definition: PropertyModel.cc:63
PropertyModel::gatherProperties
virtual void gatherProperties()=0
Searches for properties and creates PropertyVisualizers.
PropertyModel::objectUpdated
virtual void objectUpdated()=0
Revisualizes visualized properties.
PropertyModel::visualize
virtual void visualize(QModelIndexList selectedIndices, QWidgetList widgets=QWidgetList())=0
Visualizes the selected properties.
PropertyModel::hideWidget
virtual void hideWidget()=0
Hides the widget.
PropertyModel::indexFromFancyPropName
QModelIndex indexFromFancyPropName(const QString &propName) const
Returns the index of the property with the given name.
Definition: PropertyModel.cc:52
PropertyInfo
Cellection of information about a property.
Definition: Utils.hh:115
PropertyModel::updateWidget
virtual void updateWidget(const QModelIndexList &selectedIndices)=0
Updates the widget.