Diffstat (limited to 'noncore/apps/zsafe/shadedlistitem.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/apps/zsafe/shadedlistitem.cpp | 69 |
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 | |||
16 | ShadedListItem::ShadedListItem(int index, QListViewItem *parent) | ||
17 | : QListViewItem(parent) | ||
18 | { | ||
19 | oddRow = (index % 2 != 0); | ||
20 | } | ||
21 | |||
22 | ShadedListItem::ShadedListItem(int index, QListView *parent) | ||
23 | : QListViewItem(parent), lv(parent) | ||
24 | { | ||
25 | oddRow = (index % 2 != 0); | ||
26 | } | ||
27 | |||
28 | ShadedListItem::ShadedListItem(int index, QListView *parent, QListViewItem *after) | ||
29 | : QListViewItem(parent, after), lv(parent) | ||
30 | { | ||
31 | oddRow = (index % 2 != 0); | ||
32 | } | ||
33 | |||
34 | ShadedListItem::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 | |||
40 | ShadedListItem::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 | |||
46 | ShadedListItem::~ShadedListItem() | ||
47 | { | ||
48 | |||
49 | } | ||
50 | |||
51 | |||
52 | void 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 | } | ||