File indexing completed on 2025-01-05 03:51:07
0001 /* ============================================================ 0002 * 0003 * This file is a part of digiKam project 0004 * https://www.digikam.org 0005 * 0006 * Date : 2005-05-02 0007 * Description : a widget to perform month selection. 0008 * 0009 * SPDX-FileCopyrightText: 2005 by Renchi Raju <renchi dot raju at gmail dot com> 0010 * SPDX-FileCopyrightText: 2006-2024 by Gilles Caulier <caulier dot gilles at gmail dot com> 0011 * 0012 * SPDX-License-Identifier: GPL-2.0-or-later 0013 * 0014 * ============================================================ */ 0015 0016 #ifndef DIGIKAM_MONTH_WIDGET_H 0017 #define DIGIKAM_MONTH_WIDGET_H 0018 0019 // Qt includes 0020 0021 #include <QWidget> 0022 0023 // Local includes 0024 0025 #include "iteminfo.h" 0026 0027 class QResizeEvent; 0028 class QPaintEvent; 0029 class QMouseEvent; 0030 0031 namespace Digikam 0032 { 0033 class ItemFilterModel; 0034 0035 class MonthWidget : public QWidget 0036 { 0037 Q_OBJECT 0038 0039 public: 0040 0041 explicit MonthWidget(QWidget* const parent); 0042 ~MonthWidget() override; 0043 0044 void setItemModel(ItemFilterModel* const model); 0045 0046 void setYearMonth(int year, int month); 0047 QSize sizeHint() const override; 0048 0049 void setActive(bool val); 0050 0051 protected: 0052 0053 void resizeEvent(QResizeEvent* e) override; 0054 void paintEvent(QPaintEvent*) override; 0055 void mousePressEvent(QMouseEvent* e) override; 0056 0057 private: 0058 0059 void init(); 0060 0061 private Q_SLOTS: 0062 0063 void triggerUpdateDays(); 0064 void updateDays(); 0065 void slotModelDestroyed(); 0066 0067 private: 0068 0069 void resetDayCounts(); 0070 void connectModel(); 0071 0072 private: 0073 0074 class Private; 0075 Private* const d; 0076 }; 0077 0078 } // namespace Digikam 0079 0080 #endif // DIGIKAM_MONTH_WIDGET_H