LeechCraft  0.6.70-15082-g543737046d
Modular cross-platform feature rich live environment.
flatitemsmodelbase.h
Go to the documentation of this file.
1 /**********************************************************************
2  * LeechCraft - modular cross-platform feature rich internet client.
3  * Copyright (C) 2006-2014 Georg Rudoy
4  *
5  * Distributed under the Boost Software License, Version 1.0.
6  * (See accompanying file LICENSE or copy at https://www.boost.org/LICENSE_1_0.txt)
7  **********************************************************************/
8 
9 #pragma once
10 
11 #include <QAbstractItemModel>
12 #include "modelsconfig.h"
13 
14 namespace LC::Util
15 {
16  class UTIL_MODELS_API FlatItemsModelBase : public QAbstractItemModel
17  {
18  const QStringList Headers_;
19  public:
20  constexpr static auto DataRole = Qt::UserRole;
21 
22  explicit FlatItemsModelBase (QStringList headers, QObject* = nullptr);
23 
24  int columnCount (const QModelIndex& index = {}) const override;
25  QVariant data (const QModelIndex& index, int role) const override;
26  QVariant headerData (int section, Qt::Orientation orientation, int role) const override;
27  QModelIndex index (int row, int col, const QModelIndex& parent = {}) const override;
28  QModelIndex parent (const QModelIndex&) const override;
29  int rowCount (const QModelIndex& parent = {}) const override;
30  protected:
31  virtual int GetItemsCount () const = 0;
32  virtual QVariant GetData (int row, int col, int role) const = 0;
33  };
34 }
LC::Util
Definition: icoreproxy.h:33
modelsconfig.h
UTIL_MODELS_API
#define UTIL_MODELS_API
Definition: modelsconfig.h:16
LC::Util::FlatItemsModelBase
Definition: flatitemsmodelbase.h:22