00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012 #include "zsafe.h"
00013 #include "shadedlistitem.h"
00014
00015
00016 ShadedListItem::ShadedListItem(int index, QListViewItem *parent)
00017 : QListViewItem(parent)
00018 {
00019 oddRow = (index % 2 != 0);
00020 }
00021
00022 ShadedListItem::ShadedListItem(int index, QListView *parent)
00023 : QListViewItem(parent), lv(parent)
00024 {
00025 oddRow = (index % 2 != 0);
00026 }
00027
00028 ShadedListItem::ShadedListItem(int index, QListView *parent, QListViewItem *after)
00029 : QListViewItem(parent, after), lv(parent)
00030 {
00031 oddRow = (index % 2 != 0);
00032 }
00033
00034 ShadedListItem::ShadedListItem(int index, QListView *parent, QString label1, QString label2, QString label3)
00035 : QListViewItem(parent, label1, label2, label3), lv(parent)
00036 {
00037 oddRow = (index % 2 != 0);
00038 }
00039
00040 ShadedListItem::ShadedListItem(int index, QListView *parent, QListViewItem *after, QString label1, QString label2, QString label3)
00041 : QListViewItem(parent, after, label1, label2, label3), lv(parent)
00042 {
00043 oddRow = (index % 2 != 0);
00044 }
00045
00046 ShadedListItem::~ShadedListItem()
00047 {
00048
00049 }
00050
00051
00052 void ShadedListItem::paintCell(QPainter *p, const QColorGroup &cg, int column, int width, int alignment)
00053 {
00054 QColorGroup colors(cg);
00055 #if QT_VERSION >= 0x030000
00056 const QColorGroup::ColorRole crole = QColorGroup::Base;
00057
00058
00059 #else
00060 const QColorGroup::ColorRole crole = QColorGroup::Base;
00061 #endif
00062 if (oddRow) {
00063 colors.setColor(crole, *ZSafe::oddRowColor);
00064 }
00065 else {
00066 colors.setColor(crole, *ZSafe::evenRowColor);
00067 }
00068 QListViewItem::paintCell(p, colors, column, width, alignment);
00069 }