adjust datetime effect

Change-Id: Ifbae3c74a37510bf5c6338c3c0d51f2df7eb42ae
This commit is contained in:
石博文 2016-07-28 17:20:33 +08:00 committed by Hualet Wang
parent de444b01bc
commit b8597dbe20

View File

@ -45,7 +45,7 @@ void DatetimeWidget::paintEvent(QPaintEvent *e)
const QPoint backgroundOffset = r.center() - background.rect().center();
painter.drawPixmap(backgroundOffset, background);
const int bigNumHeight = perfectIconSize / 2.35;
const int bigNumHeight = perfectIconSize / 2.5;
const int bigNumWidth = double(bigNumHeight) * 8 / 18;
const int smallNumHeight = bigNumHeight / 2;
const int smallNumWidth = double(smallNumHeight) * 5 / 9;
@ -53,19 +53,19 @@ void DatetimeWidget::paintEvent(QPaintEvent *e)
// draw big num 1
const QString bigNum1Path = QString(":/icons/resources/icons/big%1.svg").arg(currentTimeString[0]);
const QPixmap bigNum1 = loadSvg(bigNum1Path, QSize(bigNumWidth, bigNumHeight));
const QPoint bigNum1Offset = backgroundOffset + QPoint(perfectIconSize / 2 - bigNumWidth * 2 + 2, perfectIconSize / 2 - bigNumHeight / 2);
const QPoint bigNum1Offset = backgroundOffset + QPoint(perfectIconSize / 2 - bigNumWidth * 2 + 1, perfectIconSize / 2 - bigNumHeight / 2);
painter.drawPixmap(bigNum1Offset, bigNum1);
// draw big num 2
const QString bigNum2Path = QString(":/icons/resources/icons/big%1.svg").arg(currentTimeString[1]);
const QPixmap bigNum2 = loadSvg(bigNum2Path, QSize(bigNumWidth, bigNumHeight));
const QPoint bigNum2Offset = bigNum1Offset + QPoint(bigNumWidth + 3, 0);
const QPoint bigNum2Offset = bigNum1Offset + QPoint(bigNumWidth + 1, 0);
painter.drawPixmap(bigNum2Offset, bigNum2);
// draw small num 1
const QString smallNum1Path = QString(":/icons/resources/icons/small%1.svg").arg(currentTimeString[2]);
const QPixmap smallNum1 = loadSvg(smallNum1Path, QSize(smallNumWidth, smallNumHeight));
const QPoint smallNum1Offset = bigNum2Offset + QPoint(bigNumWidth + 1, smallNumHeight);
const QPoint smallNum1Offset = bigNum2Offset + QPoint(bigNumWidth + 2, smallNumHeight);
painter.drawPixmap(smallNum1Offset, smallNum1);
// draw small num 2