From 4a843c631b3fe16898b7c70a4923eb4c8419af8b Mon Sep 17 00:00:00 2001 From: dos-reis Date: Tue, 2 Apr 2013 19:01:03 +0000 Subject: * gui/conversation.cc (font_units): Rename from em_metrics. Adjust callers. (Answer::Answer): Use raised frame style. --- src/gui/conversation.cc | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) (limited to 'src/gui') diff --git a/src/gui/conversation.cc b/src/gui/conversation.cc index c3357e0f..16948296 100644 --- a/src/gui/conversation.cc +++ b/src/gui/conversation.cc @@ -40,10 +40,11 @@ #include "debate.h" namespace OpenAxiom { - // Measurement in pixel of the em unit in the given font `f'. - static QSize em_metrics(const QWidget* w) { + // Largest width and line spacing, in pixel, of the font metrics + // associated with `w'. + static QSize font_units(const QWidget* w) { const QFontMetrics fm = w->fontMetrics(); - return QSize(fm.width(QLatin1Char('m')), fm.height()); + return QSize(fm.maxWidth(), fm.lineSpacing()); } // Return true if the QString `s' is morally an empty string. @@ -83,7 +84,8 @@ namespace OpenAxiom { // scrollbars. QSize OutputTextArea::sizeHint() const { - return QSize(width(), document()->lineCount() * fontMetrics().height()); + const QSize s = font_units(this); + return QSize(width(), (1 + document()->lineCount()) * s.height()); } // Concatenate two paragraphs. @@ -150,7 +152,7 @@ namespace OpenAxiom { // -- Answer -- // ------------ Answer::Answer(Exchange& e) : Base(&e), parent(&e) { - setFrameStyle(StyledPanel | Sunken); + setFrameStyle(StyledPanel | Raised); } // -------------- @@ -275,8 +277,8 @@ namespace OpenAxiom { static QSize minimum_preferred_size(const Conversation* conv) { - const QSize em = em_metrics(conv); - return QSize(columns * em.width(), lines * em.height()); + const QSize s = font_units(conv); + return QSize(columns * s.width(), lines * s.height()); } // Set a minimum preferred widget size, so no layout manager -- cgit v1.2.3