+ if(role == ChatLineModel::MsgLabelRole)
+ return messageLabel();
+
+ QVariant variant;
+ MessageModel::ColumnType col = (MessageModel::ColumnType)column;
+ switch(col) {
+ case ChatLineModel::TimestampColumn:
+ variant = timestampData(role);
+ break;
+ case ChatLineModel::SenderColumn:
+ variant = senderData(role);
+ break;
+ case ChatLineModel::ContentsColumn:
+ variant = contentsData(role);
+ break;
+ default:
+ break;
+ }
+ if(!variant.isValid())
+ return MessageModelItem::data(column, role);
+ return variant;
+}
+
+QVariant ChatLineModelItem::timestampData(int role) const {
+ switch(role) {
+ case ChatLineModel::DisplayRole:
+ return _styledMsg.decoratedTimestamp();
+ case ChatLineModel::EditRole:
+ return _styledMsg.timestamp();
+ case ChatLineModel::BackgroundRole:
+ return backgroundBrush(UiStyle::Timestamp);
+ case ChatLineModel::SelectedBackgroundRole:
+ return backgroundBrush(UiStyle::Timestamp, true);
+ case ChatLineModel::FormatRole:
+ return QVariant::fromValue<UiStyle::FormatList>(UiStyle::FormatList()
+ << qMakePair((quint16)0, (quint32)UiStyle::formatType(_styledMsg.type()) | UiStyle::Timestamp));
+ }
+ return QVariant();
+}