atrooney-online-2/include/aotextarea.h
Crystalwarrior c8e12558cd Clang-ify the code with this styling using Visual Studio Code:
{ BasedOnStyle: LLVM, UseTab: Never, IndentWidth: 4, TabWidth: 4, BreakBeforeBraces: Stroustrup, AllowShortIfStatementsOnASingleLine: false, IndentCaseLabels: false, ColumnLimit: 0, AccessModifierOffset: -4, NamespaceIndentation: All }
(this is the Visual Studio preset with only "BreakBeforeBraces" changed from Allman to Stroustrup)
2020-05-22 01:18:24 +03:00

25 lines
617 B
C++

#ifndef AOTEXTAREA_H
#define AOTEXTAREA_H
#include <QDebug>
#include <QRegExp>
#include <QScrollBar>
#include <QTextBrowser>
#include <QTextCursor>
class AOTextArea : public QTextBrowser {
public:
AOTextArea(QWidget *p_parent = nullptr);
void append_linked(QString p_message);
void append_chatmessage(QString p_name, QString p_message, QString p_colur);
void append_error(QString p_message);
private:
const QRegExp url_parser_regex = QRegExp("\\b(https?://\\S+\\.\\S+)\\b");
void auto_scroll(QTextCursor old_cursor, int scrollbar_value, bool is_scrolled_down);
};
#endif // AOTEXTAREA_H