Brief description of class still missing. More...
#include <LineItem.h>
Public Member Functions | |
virtual int | columnCount (const QModelIndex &parent=QModelIndex()) const |
virtual QVariant | data (const QModelIndex &index, int role) const |
virtual Qt::ItemFlags | flags (const QModelIndex &) const |
virtual QVariant | headerData (int section, Qt::Orientation orientation, int role=Qt::DisplayRole) const |
LineItem (QObject *parent=0) | |
virtual int | rowCount (const QModelIndex &parent=QModelIndex()) const |
virtual bool | setData (const QModelIndex &index, const QVariant &value, int role=Qt::EditRole) |
void | setLine (LineLayer *layer, AbstractLine *line) |
~LineItem () |
Brief description of class still missing.
Full description of class still missing
SciFigs::LineItem::LineItem | ( | QObject * | parent = 0 | ) |
: QAbstractTableModel(parent) { _layer=0; _line=0; }
SciFigs::LineItem::~LineItem | ( | ) | [inline] |
{}
int SciFigs::LineItem::columnCount | ( | const QModelIndex & | parent = QModelIndex() | ) | const [virtual] |
QVariant SciFigs::LineItem::data | ( | const QModelIndex & | index, |
int | role | ||
) | const [virtual] |
References SciFigs::AbstractLine::isValid(), SciFigs::AbstractLine::point(), SciFigs::LineLayer::pointOptions(), TRACE, QGpCoreTools::Point2D::x(), QGpCoreTools::Point2D::y(), and QGpCoreTools::Point::z().
{ TRACE; if(!_line) return QVariant(); if( !index.isValid()) return QVariant(); switch (role) { case Qt::DisplayRole: { Point p=_line->point(index.row(), _layer->pointOptions()); switch(index.column()) { case 1: return p.x(); case 2: return p.y(); case 3: return p.z(); default: return QVariant(); } } case Qt::CheckStateRole: if(index.column()==0) return _line->isValid(index.row()) ? Qt::Checked : Qt::Unchecked; else return QVariant(); case Qt::TextAlignmentRole: if(index.column()==0) return (int)(Qt::AlignHCenter | Qt::AlignVCenter); else return (int)(Qt::AlignRight | Qt::AlignVCenter); default: return QVariant(); } }
Qt::ItemFlags SciFigs::LineItem::flags | ( | const QModelIndex & | index | ) | const [virtual] |
References SciFigs::AbstractLine::isValid().
{ if(!_line) return 0; if(index.column()==0) { return Qt::ItemIsSelectable | Qt::ItemIsUserCheckable | Qt::ItemIsEnabled; } else { if(_line->isValid(index.row())) { return Qt::ItemIsSelectable | Qt::ItemIsEditable | Qt::ItemIsEnabled; } else { return Qt::ItemIsSelectable; } } }
QVariant SciFigs::LineItem::headerData | ( | int | section, |
Qt::Orientation | orientation, | ||
int | role = Qt::DisplayRole |
||
) | const [virtual] |
References QGpCoreTools::tr(), and TRACE.
int SciFigs::LineItem::rowCount | ( | const QModelIndex & | parent = QModelIndex() | ) | const [virtual] |
References SciFigs::AbstractLine::count(), and TRACE.
bool SciFigs::LineItem::setData | ( | const QModelIndex & | index, |
const QVariant & | value, | ||
int | role = Qt::EditRole |
||
) | [virtual] |
References SciFigs::GraphContentLayer::deepUpdate(), SciFigs::LineLayer::pointOptions(), SciFigs::AbstractLine::setValid(), SciFigs::AbstractLine::setX(), SciFigs::AbstractLine::setY(), SciFigs::AbstractLine::setZ(), and TRACE.
{ TRACE; if(!_line) return false; if( !index.isValid()) return false; switch (role) { case Qt::EditRole: { LayerLocker ll(_layer); switch(index.column()) { case 0: return false; case 1: _line->setX(index.row(), value.toDouble()); break; case 2: _line->setY(index.row(), value.toDouble(), _layer->pointOptions()); break; case 3: _line->setZ(index.row(), value.toDouble(), _layer->pointOptions()); break; default: break; } _layer->deepUpdate(); emit dataChanged(index, index); return true; } case Qt::CheckStateRole: if(index.column()==0) { LayerLocker ll(_layer); if(value.toInt()==Qt::Checked) _line->setValid(index.row(), true); else _line->setValid(index.row(), false); _layer->deepUpdate(); emit dataChanged(createIndex(index.row(), 0), createIndex(index.row(), 3)); return true; } else return false; default: return false; } }
void SciFigs::LineItem::setLine | ( | LineLayer * | layer, |
AbstractLine * | line | ||
) |