1
/***************************************************************************
2
boldmenuitem.cpp - description
5
copyright : (C) 2001 by Leonid Zeitlin
7
***************************************************************************/
9
/***************************************************************************
11
* This program is free software; you can redistribute it and/or modify *
12
* it under the terms of the GNU General Public License as published by *
13
* the Free Software Foundation; either version 2 of the License, or *
14
* (at your option) any later version. *
16
***************************************************************************/
18
#include "boldmenuitem.h"
24
#include <kglobalsettings.h>
25
#include <kdeversion.h>
26
#if KDE_VERSION_MAJOR >= 3
27
#include <kapplication.h>
33
BoldMenuItem::BoldMenuItem(const QString &text, const QColor &active_text_color,
35
: m_text(text), m_active_text_color(active_text_color), m_bold(bold)
39
BoldMenuItem::~BoldMenuItem(){
42
void BoldMenuItem::paint(QPainter* painter, const QColorGroup& /*cg*/,
43
bool act, bool /*enabled*/, int x, int y, int w, int h)
45
QFont font = painter->font();
46
if (font.bold() != m_bold) {
48
painter->setFont(font);
50
//if (act) painter->setPen(KGlobalSettings::highlightedTextColor());
51
//if (act) painter->setPen(cg.highlightedText());
52
if (act) painter->setPen(m_active_text_color);
53
kdDebug() << "bg color = " << painter->brush().color().rgb() << endl;
55
painter->drawText(x, y, w, h, AlignLeft | AlignVCenter | ShowPrefix | DontClip,
57
//KApplication::style().drawItem(painter, QRect(x, y, w, h), AlignLeft | AlignVCenter | ShowPrefix | DontClip,
58
// cg, enabled, 0, m_text);
62
void BoldMenuItem::setFont(const QFont& font)
64
m_size = QFontMetrics(font).size(AlignLeft | AlignVCenter | ShowPrefix | DontClip,
66
QCustomMenuItem::setFont(font);