digiKam
Loading...
Searching...
No Matches
ddatepicker_p.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 : 1997-04-21
7 * Description : A date selection widget.
8 *
9 * SPDX-FileCopyrightText: 2011-2024 by Gilles Caulier <caulier dot gilles at gmail dot com>
10 * SPDX-FileCopyrightText: 1997 by Tim D. Gilman <tdgilman at best dot org>
11 * SPDX-FileCopyrightText: 1998-2001 by Mirko Boehm <mirko at kde dot org>
12 * SPDX-FileCopyrightText: 2007 by John Layt <john at layt dot net>
13 *
14 * SPDX-License-Identifier: GPL-2.0-or-later
15 *
16 * ============================================================ */
17
18#pragma once
19
20// Qt includes
21
22#include <QDate>
23#include <QLineEdit>
24#include <QValidator>
25#include <QApplication>
26#include <QComboBox>
27#include <QToolButton>
28#include <QBoxLayout>
29#include <QSize>
30
31// Local includes
32
33#include "ddatepicker.h"
34
35namespace Digikam
36{
37
38class Q_DECL_HIDDEN DatePickerValidator : public QValidator
39{
40 Q_OBJECT
41
42public:
43
44 explicit DatePickerValidator(DDatePicker* const parent);
45
46 State validate(QString& text, int&) const override;
47
48private:
49
50 DDatePicker* m_picker = nullptr;
51};
52
53// ------------------------------------------------------------------------------
54
55class Q_DECL_HIDDEN DatePickerYearSelector : public QLineEdit
56{
57 Q_OBJECT
58
59public:
60
61 explicit DatePickerYearSelector(const QDate& currentDate, QWidget* const parent = nullptr);
62
63 int year() const;
64 void setYear(int year);
65
66public Q_SLOTS:
67
68 void yearEnteredSlot();
69
70Q_SIGNALS:
71
72 void closeMe(int);
73
74protected:
75
76 QIntValidator* val = nullptr;
77 int result = 0;
78
79private:
80
81 QDate oldDate;
82
83 Q_DISABLE_COPY(DatePickerYearSelector)
84};
85
86// ------------------------------------------------------------------------------
87
88class Q_DECL_HIDDEN DDatePicker::Private
89{
90public:
91
92 explicit Private(DDatePicker* const qq);
93
94 void fillWeeksCombo();
95 QDate validDateInYearMonth(int year, int month);
96
97public:
98
100 DDatePicker* q = nullptr;
101
102 QToolButton* closeButton = nullptr;
103 QComboBox* selectWeek = nullptr;
104 QToolButton* todayButton = nullptr;
105 QBoxLayout* navigationLayout = nullptr;
106
108 QToolButton* yearForward = nullptr;
109
111 QToolButton* yearBackward = nullptr;
112
114 QToolButton* monthForward = nullptr;
115
117 QToolButton* monthBackward = nullptr;
118
120 QToolButton* selectMonth = nullptr;
121
123 QToolButton* selectYear = nullptr;
124
126 QLineEdit* line = nullptr;
127
129 DatePickerValidator* val = nullptr;
130
132 DDateTable* table = nullptr;
133
136
138 int fontsize = 0;
139};
140
141} // namespace Digikam
Definition ddatepicker_p.h:89
QSize maxMonthRect
the widest month string in pixels:
Definition ddatepicker_p.h:135
Definition ddatepicker.h:40
Definition ddatetable.h:40
Definition ddatepicker_p.h:39
Definition ddatepicker_p.h:56
Definition datefolderview.cpp:34
Definition abstractalbumtreeview_p.h:75