Brief description of class still missing. More...
#include <ModeItem.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 |
virtual QModelIndex | index (int, int column, const QModelIndex &parent=QModelIndex()) const |
ModeItem (QObject *parent=0) | |
virtual QModelIndex | parent (const QModelIndex &) const |
virtual int | rowCount (const QModelIndex &parent=QModelIndex()) const |
void | setCurve (ModalCurve *c) |
virtual bool | setData (const QModelIndex &index, const QVariant &value, int role=Qt::EditRole) |
~ModeItem () |
Brief description of class still missing.
Full description of class still missing
QGpGuiWave::ModeItem::ModeItem | ( | QObject * | parent = 0 | ) | [inline] |
Description of constructor still missing
: QAbstractItemModel(parent) {_curve=0;}
QGpGuiWave::ModeItem::~ModeItem | ( | ) | [inline] |
Description of destructor still missing
{}
int QGpGuiWave::ModeItem::columnCount | ( | const QModelIndex & | parent = QModelIndex() | ) | const [virtual] |
QVariant QGpGuiWave::ModeItem::data | ( | const QModelIndex & | index, |
int | role | ||
) | const [virtual] |
References QGpCoreWave::Mode::index(), QGpCoreWave::ModalCurve::modes(), QGpCoreWave::Mode::polarisationString(), QGpCoreWave::Mode::slownessString(), and TRACE.
{ TRACE; if(!_curve) return QVariant(); if( !index.isValid() || index.row() >= _curve->modes().count() || index.column() >=3) return QVariant(); const Mode& m=_curve->modes().at(index.row()); switch (role) { case Qt::DisplayRole: switch(index.column()) { case 0: return m.slownessString(); case 1: return m.polarisationString(); case 2: return m.index(); default: break; } default: return QVariant(); } }
virtual Qt::ItemFlags QGpGuiWave::ModeItem::flags | ( | const QModelIndex & | ) | const [inline, virtual] |
{
return Qt::ItemIsSelectable | Qt::ItemIsEditable | Qt::ItemIsEnabled;
}
QVariant QGpGuiWave::ModeItem::headerData | ( | int | section, |
Qt::Orientation | orientation, | ||
int | role = Qt::DisplayRole |
||
) | const [virtual] |
References QGpCoreTools::tr(), and TRACE.
{ TRACE; switch (role) { case Qt::DisplayRole: if(orientation==Qt::Horizontal) { switch (section) { case 0: return tr("Slowness"); case 1: return tr("Polarisation"); case 2: return tr("Mode index"); default: return 0; } } else { return section + 1; } case Qt::ToolTipRole: if(section==2) return tr("0=fundamental mode, 1=first higher,..."); default: return QVariant(); } }
QModelIndex QGpGuiWave::ModeItem::index | ( | int | row, |
int | column, | ||
const QModelIndex & | parent = QModelIndex() |
||
) | const [virtual] |
References QGpCoreWave::ModalCurve::modes(), and TRACE.
virtual QModelIndex QGpGuiWave::ModeItem::parent | ( | const QModelIndex & | ) | const [inline, virtual] |
{return QModelIndex();}
int QGpGuiWave::ModeItem::rowCount | ( | const QModelIndex & | parent = QModelIndex() | ) | const [virtual] |
References QGpCoreWave::ModalCurve::modes(), and TRACE.
void QGpGuiWave::ModeItem::setCurve | ( | ModalCurve * | c | ) |
References TRACE.
Referenced by QGpGuiWave::ModalCurveBrowser::clear(), and QGpGuiWave::ModeSelector::setCurve().
{ TRACE; _curve=c; reset(); }
bool QGpGuiWave::ModeItem::setData | ( | const QModelIndex & | index, |
const QVariant & | value, | ||
int | role = Qt::EditRole |
||
) | [virtual] |
References QGpCoreWave::ModalCurve::modes(), QGpCoreWave::Mode::setIndex(), QGpCoreWave::Mode::setPolarisation(), QGpCoreWave::Mode::setSlowness(), and TRACE.
{ TRACE; if(!_curve) return false; if( !index.isValid() || index.row() >= _curve->modes().count() || index.column() >=3) return false; Mode& m=_curve->modes()[ index.row() ]; switch (role) { case Qt::EditRole: switch(index.column()) { case 0: m.setSlowness(value.toString()); break; case 1: m.setPolarisation(value.toString()); break; case 2: m.setIndex(value.toInt()); break; default: break; } return true; default: return false; } }