StatusEventItem.cpp
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #include "StatusEventItem.h"
00018
00019 #include <QTime>
00020 #include <QPixmap>
00021 #include <QString>
00022
00023 StatusEventItem::StatusEventItem(QTreeWidget *parent)
00024 : QTreeWidgetItem(parent, QTreeWidgetItem::UserType)
00025 {
00026 }
00027
00028 void
00029 StatusEventItem::setTimestamp(const QTime ×tamp)
00030 {
00031 setData(0, TimestampRole, timestamp);
00032 }
00033
00034 QTime
00035 StatusEventItem::timestamp() const
00036 {
00037 return data(0, TimestampRole).toTime();
00038 }
00039
00040 void
00041 StatusEventItem::setIcon(const QPixmap &pixmap)
00042 {
00043 setData(0, IconRole, pixmap);
00044 }
00045
00046 QPixmap
00047 StatusEventItem::icon() const
00048 {
00049 return data(0, IconRole).value<QPixmap>();
00050 }
00051
00052 void
00053 StatusEventItem::setTitle(const QString &title)
00054 {
00055 setData(0, TitleRole, title);
00056 }
00057
00058 QString
00059 StatusEventItem::title() const
00060 {
00061 return data(0, TitleRole).toString();
00062 }
00063
00064 void
00065 StatusEventItem::setDescription(const QString &description)
00066 {
00067 setData(0, DescriptionRole, description);
00068 }
00069
00070 QString
00071 StatusEventItem::description() const
00072 {
00073 return data(0, DescriptionRole).toString();
00074 }
00075
00076 void
00077 StatusEventItem::setHelpUrl(const QString &url)
00078 {
00079 setData(0, HelpUrlRole, url);
00080 }
00081
00082 QString
00083 StatusEventItem::helpUrl() const
00084 {
00085 return data(0, HelpUrlRole).toString();
00086 }
00087
00088 void
00089 StatusEventItem::setToolTip(const QString &toolTip)
00090 {
00091 QTreeWidgetItem::setToolTip(0, toolTip);
00092 }
00093
00094 QString
00095 StatusEventItem::toString() const
00096 {
00097 return QString("[%1] %2 - %3").arg(timestamp().toString())
00098 .arg(title())
00099 .arg(description());
00100 }
00101
00102 bool
00103 StatusEventItem::operator<(const QTreeWidgetItem &other) const
00104 {
00105 QTime a = data(0, TimestampRole).toTime();
00106 QTime b = other.data(0, TimestampRole).toTime();
00107
00108 return (a < b);
00109 }
00110