Changeset 5ec938e


Ignore:
Timestamp:
08/15/11 20:01:18 (10 years ago)
Author:
gregor herrmann <gregoa@…>
Branches:
master, qt5
Children:
f0e0ac0
Parents:
a9f56bb
Message:

Improve day navigator widget.

(Still black magic, now even with #ifdefs :/)

Location:
src/gui
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • src/gui/daynavigatorwidget.cpp

    ra9f56bb r5ec938e  
    8686        configureNavigation();
    8787        emit(dateChanged(mCurDate));
    88         selectedDate->update();
     88        this->update();
    8989    }
    9090}
     
    9797        configureNavigation();
    9898        emit(dateChanged(mCurDate));
    99         selectedDate->update();
     99        this->update();
    100100    }
    101101}
     
    109109        configureNavigation();
    110110        emit(dateChanged(mCurDate));
    111         selectedDate->update();
     111        this->update();
    112112    }
    113113}
     
    120120    QPainter painter(this);
    121121    painter.save();
    122     QRect q(y()-height()+16, x(), height(), width()); // today icon size = 32x32
     122
     123    // rectangle only for the text
     124    int marginSize = 9;
     125    int buttonSize = 32;
     126#ifdef MAEMO
     127    QRect q(y()-height()+1*marginSize+2.5*buttonSize, x(), height()-2*marginSize-2.5*buttonSize, width());
     128#else
     129    QRect q(y()-height()+1*marginSize+2*buttonSize, x(), height()-2*marginSize-3*buttonSize, width());
     130#endif
    123131    painter.rotate(270);
     132
     133    // font size adjustion, static on maemo, dynamically otherwise
     134    QFont f = painter.font();
     135#ifdef MAEMO
     136    qreal factor = 0.8;
     137#else
     138    qreal factor = (qreal) 2 * q.width() / painter.fontMetrics().width(selectedDateStr);
     139#endif
     140    if (factor < 1) f.setPointSizeF(f.pointSizeF() * factor);
     141    painter.setFont(f);
     142
    124143    painter.drawText(q, Qt::AlignCenter, selectedDateStr);
    125144    painter.restore();
  • src/gui/daynavigatorwidget.ui

    ra9f56bb r5ec938e  
    2626   <item row="1" column="0">
    2727    <layout class="QVBoxLayout" name="verticalLayout">
     28     <property name="spacing">
     29      <number>0</number>
     30     </property>
    2831     <item>
    2932      <widget class="QToolButton" name="nextDayButton">
Note: See TracChangeset for help on using the changeset viewer.