Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

shadedlistitem.cpp

Go to the documentation of this file.
00001 /*
00002  * shadedlistitem.cpp
00003  *
00004  * (c) 2003 by Jeremy Bowman <jmbowman@alum.mit.edu>
00005  *
00006  * This program is free software; you can redistribute it and/or modify
00007  * it under the terms of the GNU General Public License as published by
00008  * the Free Software Foundation; either version 2 of the License, or
00009  * (at your option) any later version.
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     // const QWidget::BackgroundMode bgmode = lv->viewport()->backgroundMode();
00058     // const QColorGroup::ColorRole crole = QPalette::backgroundRoleFromMode(bgmode);
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 }

Generated on Sat Nov 5 16:17:15 2005 for OPIE by  doxygen 1.4.2