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
11 #include "qcoloritem.h"
14 #include <qfontmetrics.h>
16 QColorItem::QColorItem(QColor c, QString const & t)
20 QFontMetrics metrics(font);
22 ascent_ = metrics.ascent();
23 width_ = 40 + metrics.width(t) + 5;
24 height_ = metrics.ascent() + metrics.descent() + 6;
28 void QColorItem::paint(QPainter * p)
30 p->fillRect(2, 2, 35, height_, color_);
31 p->drawText(40, 3 + ascent_, text_);