+ if (event->type() == QEvent::Leave) {
+ _mouseEntered = false;
+ }
+
+ if (event->type() != QEvent::KeyRelease)
+ return QObject::eventFilter(obj, event);
+
+ auto* keyEvent = static_cast<QKeyEvent*>(event);
+
+ if (keyEvent->key() == Qt::Key_Escape) {
+ switchPlain();
+ return true;
+ }
+
+ return false;
+}
+
+QString TopicWidget::sanitizeTopic(const QString& topic)
+{
+ // Normally, you don't have new lines in topic messages
+ // But the use of "plain text" functionnality from Qt replaces
+ // some unicode characters with a new line, which then triggers
+ // a stack overflow later
+ QString result(topic);
+ result.replace(QChar::CarriageReturn, " ");
+ result.replace(QChar::ParagraphSeparator, " ");
+ result.replace(QChar::LineSeparator, " ");