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"
14 #include "GuiFontMetrics.h"
17 #include <QPaintEvent>
22 void GuiFontExample::set(QFont const & font, QString const & text)
30 QSize GuiFontExample::sizeHint() const
32 lyx::frontend::GuiFontMetrics m(font_);
33 return QSize(m.width(text_) + 10, m.maxHeight() + 6);
37 void GuiFontExample::paintEvent(QPaintEvent *)
40 lyx::frontend::GuiFontMetrics m(font_);
44 p.drawRect(0, 0, width() - 1, height() - 1);
45 p.drawText(5, 3 + m.maxAscent(), text_);