#include <QTextLayout>
#include <QMenu>
+#include "action.h"
#include "buffermodel.h"
#include "bufferview.h"
#include "chatline.h"
_boundingRect(boundingRect),
_selectionMode(NoSelection),
_selectionStart(-1),
- _cachedLayout(0)
+ _cachedLayout(nullptr)
{
}
void ChatItem::clearCache()
{
delete _cachedLayout;
- _cachedLayout = 0;
+ _cachedLayout = nullptr;
}
using Label = UiStyle::MessageLabel;
using Format = UiStyle::Format;
- Label itemLabel = data(ChatLineModel::MsgLabelRole).value<Label>();
+ auto itemLabel = data(ChatLineModel::MsgLabelRole).value<Label>();
const auto &fmtList = formatList();
struct LabelFormat {
ContentsChatItem::ContentsChatItem(const QPointF &pos, const qreal &width, ChatLine *parent)
: ChatItem(QRectF(pos, QSizeF(width, 0)), parent),
- _data(0)
+ _data(nullptr)
{
setPos(pos);
setGeometryByWidth(width);
void ContentsChatItem::clearCache()
{
delete _data;
- _data = 0;
+ _data = nullptr;
ChatItem::clearCache();
}
ContentsChatItemPrivate *ContentsChatItem::privateData() const
{
if (!_data) {
- ContentsChatItem *that = const_cast<ContentsChatItem *>(this);
+ auto *that = const_cast<ContentsChatItem *>(this);
that->_data = new ContentsChatItemPrivate(ClickableList::fromString(data(ChatLineModel::DisplayRole).toString()), that);
}
return _data;
qreal spacing = qMax(fontMetrics()->lineSpacing(), fontMetrics()->height()); // cope with negative leading()
qreal h = lines * spacing;
delete _data;
- _data = 0;
+ _data = nullptr;
if (w != width() || h != height())
setGeometry(w, h);
Clickable click = privateData()->currentClickable;
switch (click.type()) {
case Clickable::Url:
+ {
privateData()->activeClickable = click;
- menu->addAction(icon::get("edit-copy"), tr("Copy Link Address"),
- &_actionProxy, SLOT(copyLinkToClipboard()))->setData(QVariant::fromValue<void *>(this));
+ auto action = new Action{icon::get("edit-copy"), tr("Copy Link Address"), menu, &_actionProxy, SLOT(copyLinkToClipboard())};
+ action->setData(QVariant::fromValue<void *>(this));
+ menu->addAction(action);
break;
+ }
case Clickable::Channel:
{
// Remove existing menu actions, they confuse us when right-clicking on a clickable
}
-ContentsChatItem::WrapColumnFinder::~WrapColumnFinder()
-{
-}
-
-
qint16 ContentsChatItem::WrapColumnFinder::nextWrapColumn(qreal width)
{
if (wordidx >= wrapList.count())