33 #ifndef GAMMARAY_OBJECTMODELBASE_H
34 #define GAMMARAY_OBJECTMODELBASE_H
39 #include <QModelIndex>
47 template<
typename Base>
65 int columnCount(
const QModelIndex &parent = QModelIndex())
const
80 QVariant
dataForObject(QObject *
object,
const QModelIndex &index,
int role)
const
82 if (role == Qt::DisplayRole) {
83 if (index.column() == 0) {
85 }
else if (index.column() == 1) {
86 return object->metaObject()->className();
89 return QVariant::fromValue(
object);
90 }
else if (role == Qt::ToolTipRole) {
92 }
else if (role == Qt::DecorationRole && index.column() == 0) {
110 QVariant
headerData(
int section, Qt::Orientation orientation,
int role = Qt::DisplayRole)
const
112 if (role == Qt::DisplayRole && orientation == Qt::Horizontal) {
115 return QObject::tr(
"Object");
117 return QObject::tr(
"Type");
120 return Base::headerData(section, orientation, role);