-rw-r--r-- | libopie/ocheckitem.cpp | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/libopie/ocheckitem.cpp b/libopie/ocheckitem.cpp index d6ddc79..082d7a2 100644 --- a/libopie/ocheckitem.cpp +++ b/libopie/ocheckitem.cpp | |||
@@ -13,34 +13,65 @@ | |||
13 | #include <qpainter.h> | 13 | #include <qpainter.h> |
14 | 14 | ||
15 | #include "ocheckitem.h" | 15 | #include "ocheckitem.h" |
16 | 16 | ||
17 | /** | ||
18 | * Constructs an CheckItem with a QTable as parent | ||
19 | * and a sort key for. | ||
20 | * The sort key will be used by QTable to sort the table later | ||
21 | * @param t The parent QTable where the check item belongs | ||
22 | * @param key A sort key | ||
23 | */ | ||
17 | OCheckItem::OCheckItem( QTable *t, const QString &key ) | 24 | OCheckItem::OCheckItem( QTable *t, const QString &key ) |
18 | : QTableItem( t, Never, "" ), m_checked( FALSE ), m_sortKey( key ) | 25 | : QTableItem( t, Never, "" ), m_checked( FALSE ), m_sortKey( key ) |
19 | { | 26 | { |
20 | } | 27 | } |
21 | 28 | ||
29 | /** | ||
30 | * reimplemted for internal reasons | ||
31 | * @return Returns the sort key of the Item | ||
32 | * @see QTableItem | ||
33 | */ | ||
22 | QString OCheckItem::key() const | 34 | QString OCheckItem::key() const |
23 | { | 35 | { |
24 | return m_sortKey; | 36 | return m_sortKey; |
25 | } | 37 | } |
26 | 38 | ||
39 | /** | ||
40 | * This method can check or uncheck the item. It will | ||
41 | * call QTable to update the cell. | ||
42 | * | ||
43 | * @param b Whether to check or uncheck the item | ||
44 | */ | ||
27 | void OCheckItem::setChecked( bool b ) | 45 | void OCheckItem::setChecked( bool b ) |
28 | { | 46 | { |
29 | m_checked = b; | 47 | m_checked = b; |
30 | table()->updateCell( row(), col() ); | 48 | table()->updateCell( row(), col() ); |
31 | } | 49 | } |
32 | 50 | ||
51 | /** | ||
52 | * This will toggle the item. If it is checked it'll get | ||
53 | * unchecked by this method or vice versa. | ||
54 | */ | ||
33 | void OCheckItem::toggle() | 55 | void OCheckItem::toggle() |
34 | { | 56 | { |
35 | m_checked = !m_checked; | 57 | m_checked = !m_checked; |
36 | } | 58 | } |
37 | 59 | ||
60 | /** | ||
61 | * This will return the state of the item. | ||
62 | * | ||
63 | * @return Returns true if the item is checked | ||
64 | */ | ||
38 | bool OCheckItem::isChecked() const | 65 | bool OCheckItem::isChecked() const |
39 | { | 66 | { |
40 | return m_checked; | 67 | return m_checked; |
41 | } | 68 | } |
42 | 69 | ||
70 | /** | ||
71 | * @internal | ||
72 | * This paints the item | ||
73 | */ | ||
43 | void OCheckItem::paint( QPainter *p, const QColorGroup &cg, const QRect &cr, | 74 | void OCheckItem::paint( QPainter *p, const QColorGroup &cg, const QRect &cr, |
44 | bool ) | 75 | bool ) |
45 | { | 76 | { |
46 | p->fillRect( 0, 0, cr.width(), cr.height(), cg.brush( QColorGroup::Base ) ); | 77 | p->fillRect( 0, 0, cr.width(), cr.height(), cg.brush( QColorGroup::Base ) ); |