swift
listmodeltimestampobjects.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: Copyright (C) 2018 swift Project Community / Contributors
2 // SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-swift-pilot-client-1
3 
5 
6 #ifndef SWIFT_GUI_MODELS_LISTMODELTIMESTAMPOBJECTS_H
7 #define SWIFT_GUI_MODELS_LISTMODELTIMESTAMPOBJECTS_H
8 
9 #include <QString>
10 
12 
13 class QModelIndex;
14 class QObject;
15 
16 namespace swift::gui::models
17 {
19  template <typename T, bool UseCompare = false>
20  class CListModelTimestampObjects : public CListModelBase<T, UseCompare>
21  {
22  public:
24  using ContainerType = T;
25 
27  using ObjectType = typename T::value_type;
28 
30  bool isSortedByTimestampProperty() const;
31 
32  protected:
34  CListModelTimestampObjects(const QString &translationContext, QObject *parent = nullptr);
35 
37  void addTimestampColumns();
38  };
39 
41  template <typename T, bool UseCompare = false>
43  {
44  public:
46  using ContainerType = T;
47 
49  using ObjectType = typename T::value_type;
50 
53 
55  void push_frontKeepLatestAdjustedFirst(const ObjectType &object, int max);
56 
57  protected:
59  CListModelTimestampWithOffsetObjects(const QString &translationContext, QObject *parent = nullptr);
60 
63  };
64 } // namespace swift::gui::models
65 
66 #endif // SWIFT_GUI_MODELS_LISTMODELTIMESTAMPOBJECTS_H
typename T::value_type ObjectType
Container element type.
Definition: listmodelbase.h:41
QModelIndex parent(const QModelIndex &child) const final
List model for timestamp based objects with offset.
bool isSortedByTimestampProperty() const
Sorted by one of the timestamp columns?
typename T::value_type ObjectType
Container element type.
CListModelTimestampObjects(const QString &translationContext, QObject *parent=nullptr)
Constructor.
List model for timestamp based objects with offset.
typename T::value_type ObjectType
Container element type.
void addTimestampOffsetColumns()
Standard timestamp offset columns.
void push_frontKeepLatestAdjustedFirst(const ObjectType &object, int max)
Insert as first element by keeping maxElements and the latest first.
CListModelTimestampWithOffsetObjects(const QString &translationContext, QObject *parent=nullptr)
Constructor.
Models to be used with views, mainly QTableView.