digiKam
itemcategorydrawer.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 : 2009-04-20
7  * Description : Qt model-view for items - category drawer
8  *
9  * Copyright (C) 2009-2011 by Marcel Wiesweg <marcel dot wiesweg at gmx dot de>
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_ITEM_CATEGORY_DRAWER_H
25 #define DIGIKAM_ITEM_CATEGORY_DRAWER_H
26 
27 // Local includes
28 
29 #include "dcategorydrawer.h"
30 
31 class QStyleOptionViewItem;
32 
33 namespace Digikam
34 {
35 
36 class ItemCategorizedView;
37 class Album;
38 class PAlbum;
39 class TAlbum;
40 class SAlbum;
41 class DAlbum;
42 
44 {
45  Q_OBJECT
46 
47 public:
48 
49  explicit ItemCategoryDrawer(ItemCategorizedView* const parent);
50  ~ItemCategoryDrawer() override;
51 
52  int categoryHeight(const QModelIndex& index, const QStyleOption& option) const override;
53  void drawCategory(const QModelIndex& index, int sortRole, const QStyleOption& option, QPainter* painter) const override;
54  virtual int maximumHeight() const;
55 
56  void setLowerSpacing(int spacing);
57  void setDefaultViewOptions(const QStyleOptionViewItem& option);
59 
60 private:
61 
62  void updateRectsAndPixmaps(int width);
63  void viewHeaderText(const QModelIndex& index, QString* header, QString* subLine) const;
64  void textForAlbum(const QModelIndex& index, QString* header, QString* subLine) const;
65  void textForPAlbum(PAlbum* a, bool recursive, int count, QString* header, QString* subLine) const;
66  void textForTAlbum(TAlbum* a, bool recursive, int count, QString* header, QString* subLine) const;
67  void textForSAlbum(SAlbum* a, int count, QString* header, QString* subLine) const;
68  void textForDAlbum(DAlbum* a, int count, QString* header, QString* subLine) const;
69  void textForFormat(const QModelIndex& index, QString* header, QString* subLine) const;
70  void textForMonth(const QModelIndex& index, QString* header, QString* subLine) const;
71  void textForFace(const QModelIndex& index, QString* header, QString* subLine) const;
72 
73 private:
74 
75  class Private;
76  Private* const d;
77 };
78 
79 } // namespace Digikam
80 
81 #endif // DIGIKAM_ITEM_CATEGORY_DRAWER_H
Definition: album.h:460
Definition: dcategorydrawer.h:52
Definition: itemcategorizedview.h:49
Definition: itemcategorydrawer.h:44
ItemCategoryDrawer(ItemCategorizedView *const parent)
Definition: itemcategorydrawer.cpp:70
void setLowerSpacing(int spacing)
Definition: itemcategorydrawer.cpp:92
virtual int maximumHeight() const
Definition: itemcategorydrawer.cpp:87
int categoryHeight(const QModelIndex &index, const QStyleOption &option) const override
Definition: itemcategorydrawer.cpp:82
void invalidatePaintingCache()
Definition: itemcategorydrawer.cpp:107
void drawCategory(const QModelIndex &index, int sortRole, const QStyleOption &option, QPainter *painter) const override
Definition: itemcategorydrawer.cpp:117
~ItemCategoryDrawer() override
Definition: itemcategorydrawer.cpp:77
void setDefaultViewOptions(const QStyleOptionViewItem &option)
Definition: itemcategorydrawer.cpp:97
Definition: album.h:357
Definition: album.h:493
Definition: album.h:420
@ Album
Definition: coredbfields.h:58
Definition: datefolderview.cpp:43