Eventviews

timelabels.h
1/*
2 SPDX-FileCopyrightText: 2000, 2001, 2003 Cornelius Schumacher <schumacher@kde.org>
3 SPDX-FileCopyrightText: 2003-2004 Reinhold Kainhofer <reinhold@kainhofer.com>
4 SPDX-FileCopyrightText: 2007 Bruno Virlet <bruno@virlet.org>
5
6 SPDX-License-Identifier: GPL-2.0-or-later WITH Qt-Commercial-exception-1.0
7*/
8#pragma once
9
10#include <QTimeZone>
11
12#include <QFrame>
13
14namespace EventViews
15{
16class Agenda;
17class TimeLabelsZone;
18
19class Prefs;
20using PrefsPtr = QSharedPointer<Prefs>;
21
22class TimeLabels : public QWidget
23{
25public:
26 using List = QList<TimeLabels *>;
27
28 TimeLabels(const QTimeZone &zone, int rows, TimeLabelsZone *parent = nullptr, Qt::WindowFlags f = {});
29
30 /** updates widget's internal state */
31 void updateConfig();
32
33 /** */
34 void setAgenda(Agenda *agenda);
35
36 /** */
37 void paintEvent(QPaintEvent *e) override;
38
39 /** */
40 void contextMenuEvent(QContextMenuEvent *event) override;
41
42 /** Returns the time zone of this label */
43 [[nodiscard]] QTimeZone timeZone() const;
44
45 /**
46 Return string which can be used as a header for the time label.
47 */
48 [[nodiscard]] QString header() const;
49
50 /**
51 Return string which can be used as a tool tip for the header.
52 */
53 [[nodiscard]] QString headerToolTip() const;
54
55 QSize sizeHint() const override;
56
57 QSize minimumSizeHint() const override;
58
59 /** */
60 bool event(QEvent *event) override;
61
62private:
63 [[nodiscard]] int yposToCell(const int ypos) const;
64 [[nodiscard]] int cellToHour(const int cell) const;
65 [[nodiscard]] QString cellToSuffix(const int cell) const;
66
67 /** update the position of the marker showing the mouse position */
68 void mousePosChanged(QPoint pos);
69
70 void showMousePos();
71 void hideMousePos();
72
73 void setCellHeight(double height);
74 void colorMousePos();
75 const QTimeZone mTimezone;
76 int mRows;
77 double mCellHeight;
78 int mMiniWidth;
79 Agenda *mAgenda = nullptr;
80 TimeLabelsZone *mTimeLabelsZone = nullptr;
81
82 QFrame *mMousePos = nullptr; // shows a marker for the current mouse position in y direction
83};
84}
Namespace EventViews provides facilities for displaying incidences, including events,...
Definition agenda.h:33
Q_OBJECTQ_OBJECT
QObject * parent() const const
typedef WindowFlags
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Mon Nov 18 2024 12:07:11 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.