digiKam
importcategorydrawer.h
Go to the documentation of this file.
1 /* ============================================================
2  *
3  * This file is a part of digiKam project
4  * https://www.digikam.org
5  *
6  * Date : 2012-07-17
7  * Description : Qt item view for images - category drawer
8  *
9  * Copyright (C) 2012 by Islam Wazery <wazery at ubuntu dot com>
10  *
11  * This program is free software; you can redistribute it
12  * and/or modify it under the terms of the GNU General
13  * Public License as published by the Free Software Foundation;
14  * either version 2, or (at your option)
15  * any later version.
16  *
17  * This program is distributed in the hope that it will be useful,
18  * but WITHOUT ANY WARRANTY; without even the implied warranty of
19  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20  * GNU General Public License for more details.
21  *
22  * ============================================================ */
23 
24 #ifndef DIGIKAM_IMPORT_CATEGORY_DRAWER_H
25 #define DIGIKAM_IMPORT_CATEGORY_DRAWER_H
26 
27 // Qt includes
28 
29 #include <QStyleOptionViewItem>
30 
31 // Local includes
32 
33 #include "dcategorydrawer.h"
34 
35 namespace Digikam
36 {
37 
38 class ImportCategorizedView;
39 
41 {
42  Q_OBJECT
43 
44 public:
45 
46  explicit ImportCategoryDrawer(ImportCategorizedView* const parent);
47  ~ImportCategoryDrawer() override;
48 
49  void setLowerSpacing(int spacing);
50  void setDefaultViewOptions(const QStyleOptionViewItem& option);
52 
53  int categoryHeight(const QModelIndex& index, const QStyleOption& option) const override;
54  void drawCategory(const QModelIndex& index, int sortRole,
55  const QStyleOption& option, QPainter* painter) const override;
56  virtual int maximumHeight() const;
57 
58 private:
59 
60  void updateRectsAndPixmaps(int width);
61  void viewHeaderText(const QModelIndex& index, QString* header, QString* subLine) const;
62  void textForFormat(const QModelIndex& index, QString* header, QString* subLine) const;
63  void textForDate(const QModelIndex& index, QString* header, QString* subLine) const;
64 
65 private:
66 
67  class Private;
68  Private* const d;
69 };
70 
71 } // namespace Digikam
72 
73 #endif // DIGIKAM_IMPORT_CATEGORY_DRAWER_H
Definition: dcategorydrawer.h:52
Definition: importcategorizedview.h:44
Definition: importcategorydrawer.h:41
void invalidatePaintingCache()
Definition: importcategorydrawer.cpp:99
virtual int maximumHeight() const
Definition: importcategorydrawer.cpp:79
ImportCategoryDrawer(ImportCategorizedView *const parent)
Definition: importcategorydrawer.cpp:62
int categoryHeight(const QModelIndex &index, const QStyleOption &option) const override
Definition: importcategorydrawer.cpp:74
void setLowerSpacing(int spacing)
Definition: importcategorydrawer.cpp:84
void setDefaultViewOptions(const QStyleOptionViewItem &option)
Definition: importcategorydrawer.cpp:89
void drawCategory(const QModelIndex &index, int sortRole, const QStyleOption &option, QPainter *painter) const override
Definition: importcategorydrawer.cpp:109
~ImportCategoryDrawer() override
Definition: importcategorydrawer.cpp:69
Definition: datefolderview.cpp:43