Better calculation of the day navigator date position.
authorPhilipp Spitzer <philipp@spitzer.priv.at>
Mon, 12 Dec 2011 22:04:03 +0000 (22:04 +0000)
committerPhilipp Spitzer <philipp@spitzer.priv.at>
Mon, 12 Dec 2011 22:04:03 +0000 (22:04 +0000)
src/gui/daynavigatorwidget.cpp

index c48f354..f47d630 100644 (file)
@@ -105,8 +105,7 @@ void DayNavigatorWidget::nextDayButtonClicked() {
 }
 
 
-void DayNavigatorWidget::paintEvent(QPaintEvent *aEvent)
-{
+void DayNavigatorWidget::paintEvent(QPaintEvent *aEvent) {
     Q_UNUSED(aEvent);
 
     QString selectedDateStr = mCurDate.isValid() ? mCurDate.toString("dddd\nyyyy-MM-dd") : tr("No date");
@@ -114,13 +113,7 @@ void DayNavigatorWidget::paintEvent(QPaintEvent *aEvent)
     painter.save();
 
     // rectangle only for the text
-    int marginSize = 9;
-    int buttonSize = 32;
-#ifdef MAEMO
-    QRect q(y()-height()+1*marginSize+2.5*buttonSize, x(), height()-2*marginSize-2.5*buttonSize, width());
-#else
-    QRect q(y()-height()+1*marginSize+2*buttonSize, x(), height()-2*marginSize-3*buttonSize, width());
-#endif
+    QRect q(-selectedDate->height()-selectedDate->y(), selectedDate->x(), selectedDate->height(), selectedDate->width());
     painter.rotate(270);
 
     // font size adjustion, static on maemo, dynamically otherwise