38 #ifndef GAMMARAY_OBJECTMODELBASE_H
39 #define GAMMARAY_OBJECTMODELBASE_H
44 #include <QModelIndex>
52 template<
typename Base>
70 int columnCount(
const QModelIndex &parent = QModelIndex())
const
85 QVariant
dataForObject(QObject *
object,
const QModelIndex &index,
int role)
const
87 if (role == Qt::DisplayRole) {
88 if (index.column() == 0) {
90 }
else if (index.column() == 1) {
91 return object->metaObject()->className();
94 return QVariant::fromValue(
object);
95 }
else if (role == Qt::ToolTipRole) {
97 }
else if (role == Qt::DecorationRole && index.column() == 0) {
115 QVariant
headerData(
int section, Qt::Orientation orientation,
int role = Qt::DisplayRole)
const
117 if (role == Qt::DisplayRole && orientation == Qt::Horizontal) {
120 return QObject::tr(
"Object");
122 return QObject::tr(
"Type");
125 return Base::headerData(section, orientation, role);
int columnCount(const QModelIndex &parent=QModelIndex()) const
Definition: objectmodelbase.h:70
Definition: objectmodel.h:56
QString shortDisplayString(const QObject *object)
A container for a generic Object Model derived from some Base.
Definition: objectmodelbase.h:53
QVariant dataForObject(QObject *object, const QModelIndex &index, int role) const
Definition: objectmodelbase.h:85
Definition: endpoint.h:42
QVariant headerData(int section, Qt::Orientation orientation, int role=Qt::DisplayRole) const
Definition: objectmodelbase.h:115
Declares various utility methods needed when writing a GammaRay plugin.
QString tooltipForObject(const QObject *object)
Declares the public object model roles.
QVariant iconForObject(const QObject *object)