~georg-zotti/stellarium/refraction

« back to all changes in this revision

Viewing changes to plugins/Oculars/src/gui/PropertyBasedTableModel.cpp

  • Committer: Georg Zotti
  • Date: 2011-02-18 12:37:55 UTC
  • mfrom: (4821.1.54 trunk)
  • Revision ID: georg.zotti@univie.ac.at-20110218123755-9wcuyyah7g0m1qs7
Merge-update from Trunk R4875

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
#include "PropertyBasedTableModel.hpp"
2
2
#include <QDebug>
3
3
 
 
4
/* ********************************************************************* */
 
5
#if 0
 
6
#pragma mark -
 
7
#pragma mark instance Methods
 
8
#endif
 
9
/* ********************************************************************* */
4
10
PropertyBasedTableModel::PropertyBasedTableModel(QObject *parent)
5
11
        : QAbstractTableModel(parent)
6
12
{
44
50
QVariant PropertyBasedTableModel::data(const QModelIndex &index, int role) const
45
51
{
46
52
        QVariant data;
47
 
        if ((role == Qt::DisplayRole || role ==Qt::EditRole)
 
53
        if ((role == Qt::DisplayRole || role == Qt::EditRole)
48
54
                 && index.isValid()
49
55
                 && index.row() < content->size()
50
56
                 && index.row() >= 0
59
65
bool PropertyBasedTableModel::insertRows(int position, int rows, const QModelIndex &index)
60
66
{
61
67
        Q_UNUSED(index);
62
 
        beginInsertRows(QModelIndex(), position, position+rows-1);
 
68
        beginInsertRows(QModelIndex(), position, position + rows - 1);
63
69
 
64
70
        for (int row=0; row < rows; row++) {
65
71
                QObject* newInstance = modelObject->metaObject()->newInstance(Q_ARG(QObject, *modelObject));
74
80
bool PropertyBasedTableModel::removeRows(int position, int rows, const QModelIndex &index)
75
81
{
76
82
        Q_UNUSED(index);
77
 
        beginRemoveRows(QModelIndex(), position, position+rows-1);
 
83
        beginRemoveRows(QModelIndex(), position, position + rows - 1);
78
84
 
79
85
        for (int row=0; row < rows; ++row) {
80
86
                content->removeAt(position);