All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines
Public Member Functions
QGpGuiWave::ModeItem Class Reference

Brief description of class still missing. More...

#include <ModeItem.h>

List of all members.

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 ()

Detailed Description

Brief description of class still missing.

Full description of class still missing


Constructor & Destructor Documentation

QGpGuiWave::ModeItem::ModeItem ( QObject *  parent = 0) [inline]

Description of constructor still missing

: QAbstractItemModel(parent) {_curve=0;}

Description of destructor still missing

{}

Member Function Documentation

int QGpGuiWave::ModeItem::columnCount ( const QModelIndex &  parent = QModelIndex()) const [virtual]

References TRACE.

{
  TRACE;
  return 3;
}
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.

{
  TRACE;
  if(!_curve) return QModelIndex();
  if(column < 0 || column >=3 ||
       row < 0  || row >= _curve->modes().count()) return QModelIndex();
  return createIndex(row, column);
}
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.

{
  TRACE;
  if(!_curve) return 0;
  if( !parent.isValid())
    return _curve->modes().count();
  return 0;
}

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;
  }
}

The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines