QVariant IntegrationTableModel::data(const QModelIndex& index, int role) const
{
- if (role != Qt::DisplayRole)
- return QVariant();
if (index.row() >= m_integrator->peakCount())
return QVariant();
const std::shared_ptr<IntegratedPeak> peak = m_integrator->peakByIdx(index.row());
- switch (index.column()) {
- case 0:
- return QString::number(peak->peakTime(), 'f', 4);
- case 1:
- return QString::number(peak->auc(), 'f', 4);
- case 2:
- return QString::number(peak->height(), 'f', 4);
- case 3:
- return QString::number(peak->width(), 'f', 4);
+ switch (role) {
+ case Qt::DisplayRole:
+ switch (index.column()) {
+ case 0:
+ return peak->peakTime();
+ //return QString::number(peak->peakTime(), 'f', 4);
+ case 1:
+ return QString::number(peak->auc(), 'f', 4);
+ case 2:
+ return QString::number(peak->height(), 'f', 4);
+ case 3:
+ return QString::number(peak->width(), 'f', 4);
+ default:
+ return QVariant();
+ }
+ break;
+ case Qt::TextAlignmentRole:
+ return Qt::AlignRight + Qt::AlignVCenter;
+ default:
+ return QVariant();
}
return QVariant();
}
QVariant SignalDataTableModel::data(const QModelIndex& index, int role) const
{
- if (role != Qt::DisplayRole)
- return QVariant();
if (index.row() >= m_signal->valuesCount())
return QVariant();
- if (index.column() == 0)
- return m_signal->timeAt(index.row());
- else if (index.column() == 1)
- return m_signal->valueAt(index.row());
+ switch (role) {
+ case Qt::DisplayRole:
+ switch (index.column()) {
+ case 0:
+ return m_signal->timeAt(index.row());
+ case 1:
+ return m_signal->valueAt(index.row());
+ default:
+ return QVariant();
+ }
+ break;
+ case Qt::TextAlignmentRole:
+ return Qt::AlignRight + Qt::AlignVCenter;
+ default:
+ return QVariant();
+ }
return QVariant();
}