/***************************************************************************
- * Copyright (C) 2005-2018 by the Quassel Project *
+ * Copyright (C) 2005-2020 by the Quassel Project *
* devel@quassel-irc.org *
* *
* This program is free software; you can redistribute it and/or modify *
QVariant ChatLineModelItem::data(int column, int role) const
{
if (role == ChatLineModel::MsgLabelRole)
- return QVariant::fromValue<UiStyle::MessageLabel>(messageLabel());
+ return QVariant::fromValue(messageLabel());
QVariant variant;
auto col = (MessageModel::ColumnType)column;
case ChatLineModel::SelectedBackgroundRole:
return backgroundBrush(UiStyle::FormatType::Timestamp, true);
case ChatLineModel::FormatRole:
- return QVariant::fromValue<UiStyle::FormatList>(
- {std::make_pair(quint16{0}, UiStyle::Format{UiStyle::formatType(_styledMsg.type()) | UiStyle::FormatType::Timestamp, {}, {}})});
+ return QVariant::fromValue(UiStyle::FormatList{
+ std::make_pair(quint16{0}, UiStyle::Format{UiStyle::formatType(_styledMsg.type()) | UiStyle::FormatType::Timestamp, {}, {}})});
}
return QVariant();
}
case ChatLineModel::SelectedBackgroundRole:
return backgroundBrush(UiStyle::FormatType::Sender, true);
case ChatLineModel::FormatRole:
- return QVariant::fromValue<UiStyle::FormatList>(
- {std::make_pair(quint16{0}, UiStyle::Format{UiStyle::formatType(_styledMsg.type()) | UiStyle::FormatType::Sender, {}, {}})});
+ return QVariant::fromValue(UiStyle::FormatList{
+ std::make_pair(quint16{0}, UiStyle::Format{UiStyle::formatType(_styledMsg.type()) | UiStyle::FormatType::Sender, {}, {}})});
}
return QVariant();
}
case ChatLineModel::SelectedBackgroundRole:
return backgroundBrush(UiStyle::FormatType::Contents, true);
case ChatLineModel::FormatRole:
- return QVariant::fromValue<UiStyle::FormatList>(_styledMsg.contentsFormatList());
+ return QVariant::fromValue(_styledMsg.contentsFormatList());
case ChatLineModel::WrapListRole:
if (_wrapList.isEmpty())
computeWrapList();
- return QVariant::fromValue<ChatLineModel::WrapList>(_wrapList);
+ return QVariant::fromValue(_wrapList);
}
return QVariant();
}
QTextCharFormat fmt = QtUi::style()->format({UiStyle::formatType(_styledMsg.type()) | subelement, {}, {}},
messageLabel() | (selected ? UiStyle::MessageLabel::Selected : UiStyle::MessageLabel::None));
if (fmt.hasProperty(QTextFormat::BackgroundBrush))
- return QVariant::fromValue<QBrush>(fmt.background());
+ return QVariant::fromValue(fmt.background());
return QVariant();
}
option.setWrapMode(QTextOption::NoWrap);
layout.setTextOption(option);
- layout.setAdditionalFormats(QtUi::style()->toTextLayoutList(_styledMsg.contentsFormatList(), length, messageLabel()));
+ UiStyle::setTextLayoutFormats(layout, QtUi::style()->toTextLayoutList(_styledMsg.contentsFormatList(), length, messageLabel()));
layout.beginLayout();
QTextLine line = layout.createLine();
line.setNumColumns(length);