Akonadi Contacts

dateeditwidget.h
1/*
2 This file is part of Contact Editor.
3
4 SPDX-FileCopyrightText: 2009 Tobias Koenig <tokoe@kde.org>
5
6 SPDX-License-Identifier: LGPL-2.0-or-later
7*/
8
9#pragma once
10
11#include <QDate>
12#include <QLineEdit>
13#include <QWidget>
14
16
18class QToolButton;
19
20class DateView : public QLineEdit
21{
23
24public:
25 explicit DateView(QWidget *parent = nullptr);
26
28 void resetDate();
29
30protected:
31 void contextMenuEvent(QContextMenuEvent *event) override;
32
33private:
34 void emitSignal();
35};
36
37class DateEditWidget : public QWidget
38{
40
41public:
42 enum Type {
43 General,
44 Birthday,
45 Anniversary
46 };
47
48 explicit DateEditWidget(Type type = General, QWidget *parent = nullptr);
49 ~DateEditWidget() override;
50
51 void setDate(const QDate &date);
52 [[nodiscard]] QDate date() const;
53
54 void setReadOnly(bool readOnly);
55
56private:
57 void dateSelected(const QDate &date);
58 void resetDate();
59 void updateView();
60 DateView *mView = nullptr;
61 QToolButton *mSelectButton = nullptr;
62 QToolButton *mClearButton = nullptr;
63 KDatePickerPopup *mMenu = nullptr;
64 QDate mDate;
65 bool mReadOnly = false;
66};
virtual bool event(QEvent *e) override
Q_OBJECTQ_OBJECT
Q_SIGNALSQ_SIGNALS
QObject * parent() const const
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Sat Dec 21 2024 17:05:47 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.