Brief description of class still missing. More...
#include <StationListModel.h>
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) |
| Station * | station (int index) |
| StationListModel (QObject *parent) | |
| void | update (QModelIndex index) |
| ~StationListModel () | |
Brief description of class still missing.
Full description of class still missing
| StationListModel::StationListModel | ( | QObject * | parent | ) |
| int StationListModel::columnCount | ( | const QModelIndex & | parent = QModelIndex() | ) | const [virtual] |
| 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;
}
}
| void StationListModel::setCurrentEvent | ( | Event * | e | ) |
| 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 | ) |