diff options
author | Dirk Hohndel <dirk@hohndel.org> | 2014-06-26 16:14:44 -0700 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2014-06-26 16:14:44 -0700 |
commit | 26855234acef1af7eff69fa6b6bc87880471cae3 (patch) | |
tree | 36e1ee78e481d082e9eea9b00d34fb4ed617c939 | |
parent | a925e677f18151a894e38043ff0bb06cd9eb20c1 (diff) | |
download | subsurface-26855234acef1af7eff69fa6b6bc87880471cae3.tar.gz |
Make date widget easier to read
At least on my screen this is much better.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
-rw-r--r-- | qt-ui/simplewidgets.cpp | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/qt-ui/simplewidgets.cpp b/qt-ui/simplewidgets.cpp index 3a9181383..035e27806 100644 --- a/qt-ui/simplewidgets.cpp +++ b/qt-ui/simplewidgets.cpp @@ -324,10 +324,10 @@ void DateWidget::changeEvent(QEvent *event) } } +#define DATEWIDGETWIDTH 80 void DateWidget::paintEvent(QPaintEvent *event) { - static QPixmap pix = QPixmap(":/calendar").scaled(64,64); - static int pixRedTag = 18; /* calculated using a ruler. */ + static QPixmap pix = QPixmap(":/calendar").scaled(DATEWIDGETWIDTH,64); QPainter painter(this); @@ -338,20 +338,20 @@ void DateWidget::paintEvent(QPaintEvent *event) QString day = mDate.toString("dd"); - QFont font = QFont("monospace", 5); + QFont font = QFont("monospace", 10); QFontMetrics metrics = QFontMetrics(font); painter.setFont(font); painter.setPen(QPen(QBrush(Qt::white), 0)); painter.setBrush(QBrush(Qt::white)); - painter.drawText(QPoint(4, metrics.height() + 3), month); - painter.drawText(QPoint(64 - metrics.width(year) -6, 14), year); + painter.drawText(QPoint(6, metrics.height() + 1), month); + painter.drawText(QPoint(DATEWIDGETWIDTH - metrics.width(year) - 6, metrics.height() + 1), year); font.setPointSize(14); metrics = QFontMetrics(font); painter.setPen(QPen(QBrush(Qt::black),0)); painter.setBrush(Qt::black); painter.setFont(font); - painter.drawText(QPoint(32 - metrics.width(day)/2, 45), day); + painter.drawText(QPoint(DATEWIDGETWIDTH / 2 - metrics.width(day) / 2, 45), day); if (hasFocus()) { QStyleOptionFocusRect option; |