Mercurial > hg > easyhg
changeset 56:1394c8cbf991
* Minor layout improvement
author | Chris Cannam |
---|---|
date | Tue, 16 Nov 2010 11:26:51 +0000 |
parents | 261bfb9481fe |
children | f583e44d9d31 |
files | changesetitem.cpp panned.cpp |
diffstat | 2 files changed, 19 insertions(+), 15 deletions(-) [+] |
line wrap: on
line diff
--- a/changesetitem.cpp Fri Nov 12 17:30:53 2010 +0000 +++ b/changesetitem.cpp Tue Nov 16 11:26:51 2010 +0000 @@ -56,7 +56,8 @@ if (m_wide) width = 180; int x0 = -((width - 50) / 2 - 1); - QRectF r(x0, 0, width - 3, 49); + int height = 49; + QRectF r(x0, 0, width - 3, height); paint->drawRect(r); if (scale < 0.1) { @@ -64,16 +65,6 @@ return; } - if (m_changeset->children().empty()) { - f.setBold(true); - paint->setFont(f); - QString branch = m_changeset->branch(); - int wid = width - 3; - branch = TextAbbrev::abbreviate(branch, QFontMetrics(f), wid); - paint->drawText(x0, -fh + fm.ascent() - 4, branch); - f.setBold(false); - } - paint->fillRect(QRectF(x0 + 0.5, 0.5, width - 4, fh - 0.5), QBrush(userColour)); @@ -85,7 +76,18 @@ paint->setPen(QPen(Qt::black)); - f.setItalic(true); + if (m_changeset->children().empty()) { + // write branch name + f.setBold(true); + paint->setFont(f); + QString branch = m_changeset->branch(); + int wid = width - 3; + branch = TextAbbrev::abbreviate(branch, QFontMetrics(f), wid); + paint->drawText(x0, -fh + fm.ascent() - 4, branch); + f.setBold(false); + } + +// f.setItalic(true); fm = QFontMetrics(f); fh = fm.height(); paint->setFont(f); @@ -98,8 +100,10 @@ comment = comment.split('\n')[0]; wid = width - 5; + int nlines = (height / fh) - 1; + if (nlines < 1) nlines = 1; comment = TextAbbrev::abbreviate(comment, fm, wid, TextAbbrev::ElideEnd, - "...", 2); + "...", nlines); QStringList lines = comment.split('\n'); for (int i = 0; i < lines.size(); ++i) {
--- a/panned.cpp Fri Nov 12 17:30:53 2010 +0000 +++ b/panned.cpp Tue Nov 16 11:26:51 2010 +0000 @@ -25,8 +25,8 @@ Panned::Panned() { -// setViewport(new QGLWidget(QGLFormat(QGL::SampleBuffers))); - setRenderHints(QPainter::Antialiasing); + setRenderHints(QPainter::Antialiasing | + QPainter::TextAntialiasing); } void