2 * \file GuiFontExample.cpp
3 * This file is part of LyX, the document processor.
4 * Licence details can be found in the file COPYING.
8 * Full author contact details are available in file CREDITS.
13 #include "GuiFontExample.h"
16 #include <QPaintEvent>
21 void GuiFontExample::set(QFont const & font, QString const & text)
29 QSize GuiFontExample::sizeHint() const
31 QFontMetrics m(font_);
32 return QSize(m.width(text_) + 10, m.ascent() + m.descent() + 6);
36 void GuiFontExample::paintEvent(QPaintEvent *)
39 QFontMetrics m(font_);
43 p.drawRect(0, 0, width() - 1, height() - 1);
44 p.drawText(5, 3 + m.ascent(), text_);