33 KPlotWidget::paintEvent(e);
40 long double jd0 = dt.
djd();
42 QPointF pSpring = mapToWidget( QPointF( mc->
dSpring.
djd() - jd0 - 4, -28.0 ) );
43 QPointF pSummer = mapToWidget( QPointF( mc->
dSummer.
djd() - jd0 - 4, -28.0 ) );
44 QPointF pAutumn = mapToWidget( QPointF( mc->
dAutumn.
djd() - jd0 - 4, -28.0 ) );
45 QPointF pWinter = mapToWidget( QPointF( mc->
dWinter.
djd() - jd0 - 4, -28.0 ) );
47 p.setPen( Qt::yellow );
49 f.setPointSize( f.pointSize() - 2 );
53 p.translate( leftPadding() + pSpring.x(), topPadding() + pSpring.y() );
55 p.drawText( 0, 0, i18n(
"Vernal equinox:") );
56 p.drawText( 0, 14, KGlobal::locale()->formatDateTime( mc->
dSpring, KLocale::LongDate ) );
60 p.translate( leftPadding() + pSummer.x(), topPadding() + pSummer.y() );
62 p.drawText( 0, 0, i18n(
"Summer solstice:") );
63 p.drawText( 0, 14, KGlobal::locale()->formatDateTime( mc->
dSummer, KLocale::LongDate ) );
67 p.translate( leftPadding() + pAutumn.x(), topPadding() + pAutumn.y() );
69 p.drawText( 0, 0, i18n(
"Autumnal equinox:") );
70 p.drawText( 0, 14, KGlobal::locale()->formatDateTime( mc->
dAutumn, KLocale::LongDate ) );
74 p.translate( leftPadding() + pWinter.x(), topPadding() + pWinter.y() );
76 p.drawText( 0, 0, i18n(
"Winter solstice:") );
77 p.drawText( 0, 14, KGlobal::locale()->formatDateTime( mc->
dWinter, KLocale::LongDate ) );
81 p.setPen( Qt::white );
83 p.translate( leftPadding(), topPadding() );
84 double y = mc->Plot->dataRect().bottom() + 1.5;
85 for (
int i=0; i<12; i++ ) {
88 c = mc->Plot->mapToWidget( QPointF( 0.5*(mc->
dmonth(i)+mc->
dmonth(i+1)), y ) ).toPoint();
90 c = mc->Plot->mapToWidget( QPointF( 0.5*(mc->
dmonth(i)+mc->Plot->dataRect().right()), y ) ).toPoint();
92 QRect r( -16, -8, 32, 16 );
94 p.drawText( r, Qt::AlignCenter, QDate::shortMonthName(i+1) );
100 #include "eqplotwidget.moc"
Extension of KDateTime for KStars KStarsDateTime can represent the date/time as a Julian Day...
double dmonth(int imonth)