From dadc34655c3ab961b0b0b94a10eaaba710f0b5e8 Mon Sep 17 00:00:00 2001 From: tpearson Date: Mon, 4 Jul 2011 22:38:03 +0000 Subject: Added kmymoney git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/kmymoney@1239792 283d02a7-25f6-0310-bc7c-ecb5cbfe19da --- kmymoney2/widgets/kmymoneylistviewitem.h | 88 ++++++++++++++++++++++++++++++++ 1 file changed, 88 insertions(+) create mode 100644 kmymoney2/widgets/kmymoneylistviewitem.h (limited to 'kmymoney2/widgets/kmymoneylistviewitem.h') diff --git a/kmymoney2/widgets/kmymoneylistviewitem.h b/kmymoney2/widgets/kmymoneylistviewitem.h new file mode 100644 index 0000000..64f7562 --- /dev/null +++ b/kmymoney2/widgets/kmymoneylistviewitem.h @@ -0,0 +1,88 @@ +/*************************************************************************** + kmymoneylistviewitem.h + ------------------- + begin : Wed Jun 28 2006 + copyright : (C) 2006 by Thomas Baumgart + email : Thomas Baumgart + ***************************************************************************/ + +/*************************************************************************** + * * + * 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. * + * * + ***************************************************************************/ + +#ifndef KMYMONEYLISTVIEWITEM_H +#define KMYMONEYLISTVIEWITEM_H + +// ---------------------------------------------------------------------------- +// QT Includes + +#include + +// ---------------------------------------------------------------------------- +// KDE Includes + +#include + +// ---------------------------------------------------------------------------- +// Project Includes + +class KMyMoneyCheckListItem; + +/** + * This class implements a derived version of a QListViewItem that + * allows the storage of an engine object id with the object + * + * @author Thomas Baumgart + */ +class KMyMoneyListViewItem : public QObject, public KListViewItem +{ + friend class KMyMoneyCheckListItem; + + Q_OBJECT +public: + KMyMoneyListViewItem(QListView *parent, const QString& txt, const QString& key, const QString& id); + KMyMoneyListViewItem(QListViewItem *parent, const QString& txt, const QString& key, const QString& id); + ~KMyMoneyListViewItem(); + + const QString& id(void) const { return m_id; }; + + /** + * use my own paint method + */ + void paintCell(QPainter *p, const QColorGroup &cg, int column, int width, int alignment); + + /** + * use my own backgroundColor method + */ + const QColor backgroundColor(); + + /** + * This method returns a const reference to the key passed to the constructor. The column + * defines what is returned: For @a column equals 0, the first character passed as @a key to + * the constructor concatenated with the value returned by text(0) is returned. For @a column + * equals to 1, the @a key as passed to the constructor except the first character is returned. + */ + QString key(int column, bool ascending) const; + + + /** + * Reimplemented for internal reasons + */ + bool isAlternate(void); + +private: + QString m_key; + QString m_id; + // copied from KListViewItem() + unsigned int m_isOdd : 1; + unsigned int m_isKnown : 1; + unsigned int m_unused : 30; + +}; + +#endif -- cgit v1.2.1