summaryrefslogtreecommitdiffstats
path: root/konq-plugins/domtreeviewer/domlistviewitem.cpp
blob: c24df966fb51be227a196e119e6fcdc9c5aaacbf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
/***************************************************************************
                             domlistviewitem.cpp
                             -------------------

    author               : Andreas Schlapbach
    email                : schlpbch@iam.unibe.ch
 ***************************************************************************/

/***************************************************************************
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
 ***************************************************************************/

#include "domlistviewitem.h"

#include <qpainter.h>
#include <qlistview.h>
#include <qapplication.h>

#include <kglobalsettings.h>

DOMListViewItem::DOMListViewItem( const DOM::Node &node, QListView *parent )
  : QListViewItem( parent ), m_node(node)
{
  init();
}

DOMListViewItem::DOMListViewItem( const DOM::Node &node, QListView *parent, QListViewItem *after)
  : QListViewItem( parent, after ), m_node(node)
{
  init();
}

DOMListViewItem::DOMListViewItem( const DOM::Node &node, QListViewItem *parent )
  : QListViewItem( parent ), m_node(node)
{
  init();
}

DOMListViewItem::DOMListViewItem( const DOM::Node &node, QListViewItem *parent, QListViewItem *after)
  : QListViewItem( parent, after ), m_node(node)
{
  init();
}

DOMListViewItem::~DOMListViewItem()
{
  //NOP
}

void DOMListViewItem::init()
{
  m_color = QApplication::palette().color( QPalette::Active, QColorGroup::Text );
  m_font = KGlobalSettings::generalFont();
  clos = false;
}

void DOMListViewItem::paintCell( QPainter *p, const QColorGroup &cg, int column, int width, int alignment )
{
  QColorGroup _cg( cg );
  QColor c = _cg.text();

  p->setFont(m_font);
  _cg.setColor( QColorGroup::Text, m_color );
  QListViewItem::paintCell( p, _cg, column, width, alignment );
  _cg.setColor( QColorGroup::Text, c );
}