Public Member Functions
StationListModel Class Reference

Brief description of class still missing. More...

#include <StationListModel.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 QVariant headerData (int section, Qt::Orientation orientation, int role) const
virtual int rowCount (const QModelIndex &parent=QModelIndex()) const
void setCurrentEvent (Event *e)
virtual void sort (int column, Qt::SortOrder order=Qt::AscendingOrder)
Stationstation (int index)
 StationListModel (QObject *parent)
void update (QModelIndex index)
 ~StationListModel ()

Detailed Description

Brief description of class still missing.

Full description of class still missing


Constructor & Destructor Documentation

StationListModel::StationListModel ( QObject *  parent)

Description of constructor still missing

References TRACE.

  : QAbstractTableModel(parent)
{
  TRACE;
  _event=0;
}

Description of destructor still missing

References TRACE.

{
  TRACE;
}

Member Function Documentation

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

References TRACE.

{
  TRACE;
  return 3;
}
QVariant StationListModel::data ( const QModelIndex &  index,
int  role 
) const [virtual]

References Station::distance(), Station::name(), Event::station(), Station::status(), Station::statusToString(), QGpCoreTools::tr(), and TRACE.

{
  TRACE;
  switch (role) {
  case Qt::DisplayRole: {
      const Station * s=_event->station(index.row());
      switch(index.column()) {
      default:
        return s->name();
      case 1: {
          bool ok;
          double m=s->distance(ok);
          if(ok) {
            return QString::number(m, 'f', 1);
          } else {
            return tr("---");
          }
        }
      case 2:
        return Station::statusToString(s->status());
      }
    }
    break;
  default:
    return QVariant();
  }
}
QVariant StationListModel::headerData ( int  section,
Qt::Orientation  orientation,
int  role 
) const [virtual]

References QGpCoreTools::tr(), and TRACE.

{
  TRACE;
  switch(orientation) {
  case Qt::Horizontal:
    switch(role) {
    case Qt::DisplayRole:
      switch(section) {
      default:
        return tr("Station");
      case 1:
        return tr("distance");
      case 2:
        return tr("Status");
      }
    default:
      return QVariant();
    }
  case Qt::Vertical:
    break;
  }
  switch(role) {
  case Qt::DisplayRole:
    return section+1;
  default:
    return QVariant();
  }
}
int StationListModel::rowCount ( const QModelIndex &  parent = QModelIndex()) const [virtual]

References Event::stationCount(), and TRACE.

{
  TRACE;
  if(_event) {
    return _event->stationCount();
  } else {
    return 0;
  }
}

References TRACE.

{
  TRACE;
  _event=e;
  reset();
}
void StationListModel::sort ( int  column,
Qt::SortOrder  order = Qt::AscendingOrder 
) [virtual]

References Station::setSortIndex(), Event::sortStations(), and TRACE.

{
  TRACE;
  Station::setSortIndex(order==Qt::AscendingOrder ? column+1 : -column-1);
  _event->sortStations();
  reset();
}
Station* StationListModel::station ( int  index) [inline]

References Event::station().

{return _event->station(index);}
void StationListModel::update ( QModelIndex  index)

References TRACE.

{
  TRACE;
  emit dataChanged(StationListModel::index(index.row(), 2),
                   StationListModel::index(index.row(), 2));
}

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