From: Manuel Nickschas Date: Sun, 2 Sep 2018 21:18:40 +0000 (+0200) Subject: uisupport: Let ClickableList inherit from std::vector instead of QList X-Git-Tag: test-travis-01~153 X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=commitdiff_plain;h=f00917808808161cc5fb01d0ac4da13ffffbffbb uisupport: Let ClickableList inherit from std::vector instead of QList Apparently, a class inheriting from a QList specialization cannot be properly exported, while this works fine when inheriting from std::vector instead. Since we now prefer std containers over Qt's anyway, changing the baseclass is a Good Thing™ either way, so just do it. --- diff --git a/src/qtui/chatitem.cpp b/src/qtui/chatitem.cpp index 9fadc127..bbd49bfc 100644 --- a/src/qtui/chatitem.cpp +++ b/src/qtui/chatitem.cpp @@ -759,7 +759,7 @@ Clickable ContentsChatItem::clickableAt(const QPointF &pos) const UiStyle::FormatList ContentsChatItem::formatList() const { UiStyle::FormatList fmtList = ChatItem::formatList(); - for (int i = 0; i < privateData()->clickables.count(); i++) { + for (size_t i = 0; i < privateData()->clickables.size(); i++) { Clickable click = privateData()->clickables.at(i); if (click.type() == Clickable::Url) { overlayFormat(fmtList, click.start(), click.start() + click.length(), UiStyle::FormatType::Url); diff --git a/src/uisupport/clickable.cpp b/src/uisupport/clickable.cpp index 899277d9..1f5720ef 100644 --- a/src/uisupport/clickable.cpp +++ b/src/uisupport/clickable.cpp @@ -110,7 +110,7 @@ ClickableList ClickableList::fromString(const QString &str) if (QRegExp("^#\\d+$").exactMatch(match)) continue; } - result.append(Clickable((Clickable::Type)type, matches[type], matchEnd[type] - matches[type])); + result.emplace_back((Clickable::Type)type, matches[type], matchEnd[type] - matches[type]); } } while (type >= 0); diff --git a/src/uisupport/clickable.h b/src/uisupport/clickable.h index 2c760b94..8d1c2f75 100644 --- a/src/uisupport/clickable.h +++ b/src/uisupport/clickable.h @@ -18,8 +18,9 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * ***************************************************************************/ -#ifndef CLICKABLE_H_ -#define CLICKABLE_H_ +#pragma once + +#include #include @@ -57,13 +58,10 @@ private: }; -class ClickableList : public QList +class ClickableList : public std::vector { public: static ClickableList fromString(const QString &); Clickable atCursorPos(int idx); }; - - -#endif // CLICKABLE_H_