summaryrefslogtreecommitdiffstats
path: root/kmymoney2/widgets/kmymoneychecklistitem.h
diff options
context:
space:
mode:
authortpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2011-07-04 22:38:03 +0000
committertpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2011-07-04 22:38:03 +0000
commitdadc34655c3ab961b0b0b94a10eaaba710f0b5e8 (patch)
tree99e72842fe687baea16376a147619b6048d7e441 /kmymoney2/widgets/kmymoneychecklistitem.h
downloadkmymoney-dadc34655c3ab961b0b0b94a10eaaba710f0b5e8.tar.gz
kmymoney-dadc34655c3ab961b0b0b94a10eaaba710f0b5e8.zip
Added kmymoney
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/kmymoney@1239792 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kmymoney2/widgets/kmymoneychecklistitem.h')
-rw-r--r--kmymoney2/widgets/kmymoneychecklistitem.h93
1 files changed, 93 insertions, 0 deletions
diff --git a/kmymoney2/widgets/kmymoneychecklistitem.h b/kmymoney2/widgets/kmymoneychecklistitem.h
new file mode 100644
index 0000000..6a22ec9
--- /dev/null
+++ b/kmymoney2/widgets/kmymoneychecklistitem.h
@@ -0,0 +1,93 @@
+/***************************************************************************
+ kmymoneychecklistitem - description
+ -------------------
+ begin : Wed Jun 28 2006
+ copyright : (C) 2006 by Thomas Baumgart
+ email : Thomas Baumgart <ipwizard@users.sourceforge.net>
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * 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 KMYMONEYCHECKLISTITEM_H
+#define KMYMONEYCHECKLISTITEM_H
+
+// ----------------------------------------------------------------------------
+// QT Includes
+
+#include <qobject.h>
+#include <qlistview.h>
+
+// ----------------------------------------------------------------------------
+// KDE Includes
+
+// ----------------------------------------------------------------------------
+// Project Includes
+
+class KMyMoneyListViewItem;
+
+/**
+ * This class implements a derived version of a QCheckListItem that
+ * allows the storage of an engine object id with the object and emits
+ * a signal upon state change.
+ *
+ * @author Thomas Baumgart
+ */
+class KMyMoneyCheckListItem : public QObject, public QCheckListItem
+{
+ friend class KMyMoneyListViewItem;
+
+ Q_OBJECT
+public:
+ KMyMoneyCheckListItem(QListView *parent, const QString& txt, const QString& key, const QString& id, Type type = QCheckListItem::CheckBox);
+ KMyMoneyCheckListItem(QListView *parent, QListViewItem* after, const QString& txt, const QString& key, const QString& id, Type type = QCheckListItem::CheckBox);
+ KMyMoneyCheckListItem(QListViewItem *parent, const QString& txt, const QString& key, const QString& id, Type type = QCheckListItem::CheckBox);
+ ~KMyMoneyCheckListItem();
+
+ 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();
+
+ /**
+ * see KListViewItem::isAlternate()
+ */
+ bool isAlternate(void);
+
+ /**
+ * 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;
+
+signals:
+ void stateChanged(bool);
+
+protected:
+ virtual void stateChange(bool);
+
+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