/***************************************************************************
- * 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 *
option.setAlignment(alignment);
layout->setTextOption(option);
- QList<QTextLayout::FormatRange> formatRanges = QtUi::style()
- ->toTextLayoutList(formatList(),
- layout->text().length(),
- data(ChatLineModel::MsgLabelRole).value<UiStyle::MessageLabel>());
- layout->setAdditionalFormats(formatRanges);
+ UiStyle::FormatContainer formatRanges = QtUi::style()->toTextLayoutList(
+ formatList(),
+ layout->text().length(),
+ data(ChatLineModel::MsgLabelRole).value<UiStyle::MessageLabel>()
+ );
+ UiStyle::setTextLayoutFormats(*layout, formatRanges);
}
void ChatItem::initLayout(QTextLayout* layout) const
}
// Add all formats that have an extra label to the additionalFormats list
- QList<QTextLayout::FormatRange> additionalFormats;
+ UiStyle::FormatContainer additionalFormats;
for (size_t i = 0; i < labelFmtList.size() - 1; ++i) {
if (labelFmtList[i].label != itemLabel) {
additionalFormats << QtUi::style()->toTextLayoutList({std::make_pair(labelFmtList[i].offset, labelFmtList[i].format)},
- labelFmtList[i + 1].offset,
- labelFmtList[i].label);
+ labelFmtList[i + 1].offset,
+ labelFmtList[i].label);
}
}
- return additionalFormats.toVector();
+ return UiStyle::containerToVector(additionalFormats);
}
bool ChatItem::hasSelection() const
case Clickable::Url: {
privateData()->activeClickable = click;
auto action = new Action{icon::get("edit-copy"), tr("Copy Link Address"), menu, &_actionProxy, &ActionProxy::copyLinkToClipboard};
- action->setData(QVariant::fromValue<void*>(this));
+ action->setData(QVariant::fromValue(static_cast<void*>(this)));
menu->addAction(action);
break;
}