summaryrefslogtreecommitdiff
path: root/noncore/apps/zsafe/shadedlistitem.cpp
Unidiff
Diffstat (limited to 'noncore/apps/zsafe/shadedlistitem.cpp') (more/less context) (show whitespace changes)
-rw-r--r--noncore/apps/zsafe/shadedlistitem.cpp69
1 files changed, 69 insertions, 0 deletions
diff --git a/noncore/apps/zsafe/shadedlistitem.cpp b/noncore/apps/zsafe/shadedlistitem.cpp
new file mode 100644
index 0000000..72c6261
--- a/dev/null
+++ b/noncore/apps/zsafe/shadedlistitem.cpp
@@ -0,0 +1,69 @@
1/*
2 * shadedlistitem.cpp
3 *
4 * (c) 2003 by Jeremy Bowman <jmbowman@alum.mit.edu>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 */
11
12#include "zsafe.h"
13#include "shadedlistitem.h"
14
15
16ShadedListItem::ShadedListItem(int index, QListViewItem *parent)
17 : QListViewItem(parent)
18{
19 oddRow = (index % 2 != 0);
20}
21
22ShadedListItem::ShadedListItem(int index, QListView *parent)
23 : QListViewItem(parent), lv(parent)
24{
25 oddRow = (index % 2 != 0);
26}
27
28ShadedListItem::ShadedListItem(int index, QListView *parent, QListViewItem *after)
29 : QListViewItem(parent, after), lv(parent)
30{
31 oddRow = (index % 2 != 0);
32}
33
34ShadedListItem::ShadedListItem(int index, QListView *parent, QString label1, QString label2, QString label3)
35 : QListViewItem(parent, label1, label2, label3), lv(parent)
36{
37 oddRow = (index % 2 != 0);
38}
39
40ShadedListItem::ShadedListItem(int index, QListView *parent, QListViewItem *after, QString label1, QString label2, QString label3)
41 : QListViewItem(parent, after, label1, label2, label3), lv(parent)
42{
43 oddRow = (index % 2 != 0);
44}
45
46ShadedListItem::~ShadedListItem()
47{
48
49}
50
51
52void ShadedListItem::paintCell(QPainter *p, const QColorGroup &cg, int column, int width, int alignment)
53{
54 QColorGroup colors(cg);
55#if QT_VERSION >=300
56 const QColorGroup::ColorRole crole = QColorGroup::Base;
57 // const QWidget::BackgroundMode bgmode = lv->viewport()->backgroundMode();
58 // const QColorGroup::ColorRole crole = QPalette::backgroundRoleFromMode(bgmode);
59#else
60 const QColorGroup::ColorRole crole = QColorGroup::Base;
61#endif
62 if (oddRow) {
63 colors.setColor(crole, *ZSafe::oddRowColor);
64 }
65 else {
66 colors.setColor(crole, *ZSafe::evenRowColor);
67 }
68 QListViewItem::paintCell(p, colors, column, width, alignment);
69}