File indexing completed on 2025-01-19 03:50:38
0001 /* ============================================================ 0002 * 0003 * This file is a part of digiKam project 0004 * https://www.digikam.org 0005 * 0006 * Date : 2009-04-20 0007 * Description : Qt model-view for items - category drawer 0008 * 0009 * SPDX-FileCopyrightText: 2009-2011 by Marcel Wiesweg <marcel dot wiesweg at gmx dot de> 0010 * 0011 * SPDX-License-Identifier: GPL-2.0-or-later 0012 * 0013 * ============================================================ */ 0014 0015 #ifndef DIGIKAM_ITEM_CATEGORY_DRAWER_H 0016 #define DIGIKAM_ITEM_CATEGORY_DRAWER_H 0017 0018 // Local includes 0019 0020 #include "dcategorydrawer.h" 0021 0022 class QStyleOptionViewItem; 0023 0024 namespace Digikam 0025 { 0026 0027 class ItemCategorizedView; 0028 class Album; 0029 class PAlbum; 0030 class TAlbum; 0031 class SAlbum; 0032 class DAlbum; 0033 0034 class ItemCategoryDrawer : public DCategoryDrawer 0035 { 0036 Q_OBJECT 0037 0038 public: 0039 0040 explicit ItemCategoryDrawer(ItemCategorizedView* const parent); 0041 ~ItemCategoryDrawer() override; 0042 0043 int categoryHeight(const QModelIndex& index, const QStyleOption& option) const override; 0044 void drawCategory(const QModelIndex& index, int sortRole, const QStyleOption& option, QPainter* painter) const override; 0045 virtual int maximumHeight() const; 0046 0047 void setLowerSpacing(int spacing); 0048 void setDefaultViewOptions(const QStyleOptionViewItem& option); 0049 void invalidatePaintingCache(); 0050 0051 private: 0052 0053 void updateRectsAndPixmaps(int width); 0054 void viewHeaderText(const QModelIndex& index, QString* header, QString* subLine) const; 0055 void textForAlbum(const QModelIndex& index, QString* header, QString* subLine) const; 0056 void textForPAlbum(PAlbum* a, bool recursive, int count, QString* header, QString* subLine) const; 0057 void textForTAlbum(TAlbum* a, bool recursive, int count, QString* header, QString* subLine) const; 0058 void textForSAlbum(SAlbum* a, int count, QString* header, QString* subLine) const; 0059 void textForDAlbum(DAlbum* a, int count, QString* header, QString* subLine) const; 0060 void textForFormat(const QModelIndex& index, QString* header, QString* subLine) const; 0061 void textForMonth(const QModelIndex& index, QString* header, QString* subLine) const; 0062 void textForFace(const QModelIndex& index, QString* header, QString* subLine) const; 0063 0064 private: 0065 0066 class Private; 0067 Private* const d; 0068 }; 0069 0070 } // namespace Digikam 0071 0072 #endif // DIGIKAM_ITEM_CATEGORY_DRAWER_H