MultiObjectPropertyModel.hh 2.15 KB
Newer Older
1 2 3 4
#ifndef MULTI_OBJECT_PROPERTY_MODEL_H
#define MULTI_OBJECT_PROPERTY_MODEL_H

#include "PropertyModel.hh"
5
#include "OpenFlipper/common/DataTypes.hh"
6 7 8 9 10 11 12 13

class PropertyVisualizer;

class MultiObjectPropertyModel: public PropertyModel
{
    Q_OBJECT

public:
14 15
    MultiObjectPropertyModel(const QStringList& res, QObject *parent = 0);
    virtual ~MultiObjectPropertyModel();
16

17 18
    virtual int rowCount(const QModelIndex & parent = QModelIndex()) const;
    virtual QVariant data(const QModelIndex & index, int role = Qt::DisplayRole) const;
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50
    virtual QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const;

    /// Revisualizes visualized properties.
    virtual void objectUpdated();

    /// Visualizes the selected properties.
    virtual void visualize(QModelIndexList selectedIndices, QWidgetList widgets = QWidgetList());

    /// Removes the selected properties.
    virtual void removeProperty(QModelIndexList selectedIndices);

    /// Duplicates the selected properties.
    virtual void duplicateProperty(QModelIndexList selectedIndices);

    /// Searches for properties and creates PropertyVisualizers.
    virtual void gatherProperties();

    /// Clears the selected property visualization.
    virtual void clear(QModelIndexList selectedIndices);

    /// Hides the widget.
    virtual void hideWidget();

    /// Returns the widget.
    virtual QWidget* getWidget();

    /// Updates the widget
    virtual void updateWidget(const QModelIndexList& selectedIndices);

    /// Connects the PropertyVisualizer log signals with the log slot.
    virtual void connectLogs(PropertyVisualizer* propViz);

51 52
    /// Returns the property info for the property with the given index.
    virtual PropertyInfo getPropertyInfo(const QModelIndex index) const;
53 54

private:
55 56
    QWidget* createWidgetForType(const TypeInfoWrapper& info) const;
    void setRange(const PropertyInfo& info, QWidget* widget) const;
57 58

private:
59 60
    const QStringList restriction;
    const DataType datatypes;
61
    std::vector<QString> propNames;
62 63 64
    std::vector<PropertyInfo> propInfos;
    std::vector<QWidget*> propWidgets;
    QWidget* widget;
65 66 67
};

#endif /* MULTI_OBJECT_PROPERTY_MODEL_H */