+QVariant ChatLineModelItemPrivate::data(MessageModel::ColumnType column, int role) {
+ if(needsStyling())
+ style();
+ switch(column) {
+ case ChatLineModel::TimestampColumn:
+ switch(role) {
+ case ChatLineModel::DisplayRole:
+ return _styledMsg->decoratedTimestamp();
+ case ChatLineModel::EditRole:
+ return _styledMsg->timestamp();
+ case ChatLineModel::FormatRole:
+ return QVariant::fromValue<UiStyle::FormatList>(UiStyle::FormatList()
+ << qMakePair((quint16)0, (quint32)_styledMsg->timestampFormat()));
+ }
+ break;
+ case ChatLineModel::SenderColumn:
+ switch(role) {
+ case ChatLineModel::DisplayRole:
+ return _styledMsg->decoratedSender();
+ case ChatLineModel::EditRole:
+ return _styledMsg->sender();
+ case ChatLineModel::FormatRole:
+ return QVariant::fromValue<UiStyle::FormatList>(UiStyle::FormatList()
+ << qMakePair((quint16)0, (quint32)_styledMsg->senderFormat()));
+ }
+ break;
+ case ChatLineModel::ContentsColumn:
+ switch(role) {
+ case ChatLineModel::DisplayRole:
+ case ChatLineModel::EditRole:
+ return _styledMsg->contents();
+ case ChatLineModel::FormatRole:
+ return QVariant::fromValue<UiStyle::FormatList>(_styledMsg->contentsFormatList());
+ case ChatLineModel::WrapListRole:
+ if(_wrapList.isEmpty())
+ computeWrapList();
+ return QVariant::fromValue<ChatLineModel::WrapList>(_wrapList);
+ }
+ break;
+ default:
+ Q_ASSERT(false);
+ return 0;
+ }
+ return QVariant();