Mercurial > hg > easyhg
diff src/changesetdetailitem.cpp @ 600:641ccce7c771
Avoid messing with font size when zooming, let it zoom naturally; don't delete detail item when removing it, just let it wait to be shown again (and do delete it when deleting main item)
author | Chris Cannam |
---|---|
date | Fri, 11 May 2012 17:44:33 +0100 |
parents | 533519ebc0cb |
children | ae67ea0af696 |
line wrap: on
line diff
--- a/src/changesetdetailitem.cpp Tue Apr 24 16:56:29 2012 +0100 +++ b/src/changesetdetailitem.cpp Fri May 11 17:44:33 2012 +0100 @@ -24,6 +24,7 @@ #include <QTextDocument> #include <QPainter> +#include <QAbstractTextDocumentLayout> ChangesetDetailItem::ChangesetDetailItem(Changeset *cs) : m_changeset(cs), m_doc(0) @@ -73,26 +74,15 @@ QColor branchColour = colourSet->getColourFor(m_changeset->branch()); QColor userColour = colourSet->getColourFor(m_changeset->author()); - QFont f(m_font); - QTransform t = paint->worldTransform(); float scale = std::min(t.m11(), t.m22()); - if (scale > 1.0) { - int ps = int((f.pixelSize() / scale) + 0.5); - if (ps < 8) ps = 8; - f.setPixelSize(ps); - } if (scale < 0.1) { paint->setPen(QPen(branchColour, 0)); } else { paint->setPen(QPen(branchColour, 2)); } - - paint->setFont(f); - QFontMetrics fm(f); - int fh = fm.height(); - + int width = 350; m_doc->setTextWidth(width); int height = m_doc->size().height(); @@ -135,5 +125,6 @@ delete m_doc; m_doc = new QTextDocument; m_doc->setHtml(m_changeset->formatHtml()); + m_doc->setDefaultFont(m_font); }