swift
Loading...
Searching...
No Matches
matchingstatisticsmodel.cpp
1// SPDX-FileCopyrightText: Copyright (C) 2017 swift Project Community / Contributors
2// SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-swift-pilot-client-1
3
5
6#include <QtGlobal>
7
9
10using namespace swift::misc::simulation;
11
12namespace swift::gui::models
13{
19
21 {
22 if (m_mode == mode)
23 {
24 return;
25 }
26 m_mode = mode;
27 m_columns.clear();
28 switch (mode)
29 {
30 case ForMultiSessions:
31 m_columns.addColumn(CColumn::standardString("session", CMatchingStatisticsEntry::IndexSessionId));
32 m_columns.addColumn(CColumn::standardString("model set", CMatchingStatisticsEntry::IndexModelSetId));
33 // fall thru
34 case ForSingleSession:
35 m_columns.addColumn(CColumn("type", CMatchingStatisticsEntry::IndexEntryTypeAsIcon));
36 m_columns.addColumn(CColumn::standardString("aircraft", CMatchingStatisticsEntry::IndexAircraftDesignator));
37 m_columns.addColumn(CColumn::standardString("airline", CMatchingStatisticsEntry::IndexAirlineDesignator));
38 m_columns.addColumn(CColumn::standardInteger("#", "count", CMatchingStatisticsEntry::IndexCount));
39 m_columns.addColumn(CColumn::standardString("description", CMatchingStatisticsEntry::IndexDescription));
40 break;
41 default: break;
42 }
43 this->setSortColumnByPropertyIndex(CMatchingStatisticsEntry::IndexAircraftDesignator);
44 }
45} // namespace swift::gui::models
static CColumn standardString(const QString &headerName, const swift::misc::CPropertyIndex &propertyIndex, int alignment=CDefaultFormatter::alignDefault())
Get a standard string object formatted column.
Definition columns.cpp:57
static CColumn standardInteger(const QString &headerName, const QString &toolTip, const swift::misc::CPropertyIndex &propertyIndex, int alignment=CDefaultFormatter::alignRightVCenter())
Get a standard integer value formatted column.
Definition columns.cpp:73
CListModelBase(const QString &translationContext, QObject *parent=nullptr)
virtual bool setSortColumnByPropertyIndex(const swift::misc::CPropertyIndex &propertyIndex)
Set column for sorting.
QModelIndex parent(const QModelIndex &child) const final
void setMode(MatchingStatisticsMode mode)
Set mode.
CMatchingStatisticsModel(MatchingStatisticsMode mode, QObject *parent=nullptr)
Constructor.
Models to be used with views, mainly QTableView.
QObject(QObject *parent)