Ignore:
Timestamp:
01/22/10 13:31:10 (12 years ago)
Author:
pavelpa <pavelpa@…>
Branches:
master, qt5
Children:
49c5ad3
Parents:
806b992
Message:

day navigator widget changes

  • changed from Horizontal to Vertical
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/gui/daynavigatorwidget.cpp

    r806b992 r5992909  
    11#include "daynavigatorwidget.h"
     2
     3#include <QPainter>
     4#include <QFontMetrics>
     5#include <QLabel>
    26
    37#include <QDebug>
     
    1216    connect(prevDayButton, SIGNAL(clicked()), SLOT(prevDayButtonClicked()));
    1317    connect(nextDayButton, SIGNAL(clicked()), SLOT(nextDayButtonClicked()));
     18
     19    mFontMetrics = new QFontMetrics(QLabel().font());
    1420}
    1521
     
    2329    mCurDate = aStartDate;
    2430
    25     currentDateLabel->setText(mCurDate.toString());
     31    QRect rect = mFontMetrics->boundingRect(mCurDate.toString("MMM dd yyyy"));
     32    qDebug() << mCurDate.toString();
     33
    2634    if(mStartDate==mEndDate) // only one day conference
    2735    {
     
    4553    {
    4654        mCurDate = mCurDate.addDays(-1);
    47         currentDateLabel->setText(mCurDate.toString());
    4855        // check start date
    4956        if(mCurDate==mStartDate || mStartDate==mEndDate)
     
    5865
    5966        emit(dateChanged(mCurDate));
     67        selectedDate->update();
    6068    }
    6169}
     
    6775    {
    6876        mCurDate = mCurDate.addDays(1);
    69         currentDateLabel->setText(mCurDate.toString());
    7077        // check start date
    7178        if(mCurDate==mStartDate || mStartDate==mEndDate)
     
    8087
    8188        emit(dateChanged(mCurDate));
     89        selectedDate->update();
    8290    }
    8391}
     
    8896}
    8997
     98void DayNavigatorWidget::paintEvent(QPaintEvent *aEvent)
     99{
     100    QString selectedDateStr = mCurDate.toString("MMM dd yyyy");
     101
     102    QPainter painter(this);
     103    painter.save();
     104    QRect r = selectedDate->geometry();
     105    QRect s = mFontMetrics->boundingRect(selectedDateStr);
     106    QPoint p = QPoint(
     107            r.x() + r.width()/2 - s.height()/2 - mFontMetrics->descent(),
     108            - 130
     109            );
     110
     111    painter.translate(r.width()/2, r.height()/2);
     112    painter.rotate(270);
     113    painter.drawText(p.y(), p.x(), selectedDateStr); // y,x,string
     114    painter.restore();
     115}
     116
Note: See TracChangeset for help on using the changeset viewer.