swift
aircraftcategorylistmodel.cpp
1 // SPDX-FileCopyrightText: Copyright (C) 2019 swift Project Community / Contributors
2 // SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-swift-pilot-client-1
3 
5 
6 #include <Qt>
7 #include <QtGlobal>
8 
10 #include "gui/models/columns.h"
11 #include "misc/db/datastore.h"
12 #include "misc/timestampbased.h"
13 
14 using namespace swift::misc::aviation;
15 
16 namespace swift::gui::models
17 {
18  CAircraftCategoryListModel::CAircraftCategoryListModel(QObject *parent)
19  : CListModelDbObjects("AircraftCategoryListModel", parent)
20  {
21  m_columns.addColumn(CColumn::standardString("id", CAircraftCategory::IndexDbIntegerKey,
23  m_columns.addColumn(CColumn::standardString("level", CAircraftCategory::IndexLevelString));
24  m_columns.addColumn(CColumn::standardString("path", CAircraftCategory::IndexPath));
25  m_columns.addColumn(CColumn::standardString("name", CAircraftCategory::IndexName));
26  m_columns.addColumn(CColumn::standardString("description", CAircraftCategory::IndexDescription));
27  m_columns.addColumn(CColumn::standardString("changed", CAircraftCategory::IndexUtcTimestampFormattedYmdhms));
28 
29  // default sort order
30  this->setSortColumnByPropertyIndex(CAircraftCategory::IndexLevelString);
31  m_sortOrder = Qt::AscendingOrder;
32  }
33 } // 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
void addColumn(const CColumn &column)
Add a column.
Definition: columns.cpp:100
static int alignRightVCenter()
Align right/vertically centered.
virtual bool setSortColumnByPropertyIndex(const swift::misc::CPropertyIndex &propertyIndex)
Set column for sorting.
Models to be used with views, mainly QTableView.