aboutsummaryrefslogtreecommitdiff
path: root/src/gui
diff options
context:
space:
mode:
authordos-reis <gdr@axiomatics.org>2013-04-02 19:01:03 +0000
committerdos-reis <gdr@axiomatics.org>2013-04-02 19:01:03 +0000
commit4a843c631b3fe16898b7c70a4923eb4c8419af8b (patch)
treef5e96ef65660bc9e38958f054ee13f4eeff7b563 /src/gui
parentb8f0a3083fa5f6fdc821a7ccca2f7d7e6395b94c (diff)
downloadopen-axiom-4a843c631b3fe16898b7c70a4923eb4c8419af8b.tar.gz
* gui/conversation.cc (font_units): Rename from em_metrics.
Adjust callers. (Answer::Answer): Use raised frame style.
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/conversation.cc16
1 files changed, 9 insertions, 7 deletions
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