File indexing completed on 2024-04-21 14:46:51

0001 /*
0002     SPDX-FileCopyrightText: 2008 Jason Harris <kstars@30doradus.org>
0003 
0004     SPDX-License-Identifier: GPL-2.0-or-later
0005 */
0006 
0007 #ifndef CALENDARWIDGET_H_
0008 #define CALENDARWIDGET_H_
0009 
0010 #include <QDate>
0011 #include <kplotwidget.h>
0012 
0013 /** @class CalendarWidget
0014  *@short An extension of the KPlotWidget for the SkyCalendar tool.
0015  */
0016 class CalendarWidget : public KPlotWidget
0017 {
0018     Q_OBJECT
0019   public:
0020     explicit CalendarWidget(QWidget *parent = nullptr);
0021     void setHorizon();
0022     inline float getRiseTime(int i) { return riseTimeList.at(i); }
0023     inline float getSetTime(int i) { return setTimeList.at(i); }
0024 
0025   protected:
0026     void paintEvent(QPaintEvent *e) override;
0027 
0028   private:
0029     void drawHorizon(QPainter *p);
0030     void drawAxes(QPainter *p) override;
0031 
0032     QList<QDate> dateList;
0033     QList<float> riseTimeList;
0034     QList<float> setTimeList;
0035 
0036     float minSTime;
0037     float maxRTime;
0038 
0039     QPolygonF polySunRise;
0040     QPolygonF polySunSet;
0041 };
0042 
0043 #endif