diff options
author | Petr Mrázek <peterix@gmail.com> | 2021-11-22 03:55:16 +0100 |
---|---|---|
committer | Petr Mrázek <peterix@gmail.com> | 2021-11-22 03:55:16 +0100 |
commit | b258eac215c791b2a8eed10cecbbf9551c87f0b9 (patch) | |
tree | 1ae72f62d344f6a9c982b9dc5d598d32fc742acc /launcher/ui/widgets/LogView.h | |
parent | 5040231f8d6ca865ea50250509c3315ea0c7400e (diff) | |
download | PrismLauncher-b258eac215c791b2a8eed10cecbbf9551c87f0b9.tar.gz PrismLauncher-b258eac215c791b2a8eed10cecbbf9551c87f0b9.tar.bz2 PrismLauncher-b258eac215c791b2a8eed10cecbbf9551c87f0b9.zip |
NOISSUE continue reshuffling the codebase
Diffstat (limited to 'launcher/ui/widgets/LogView.h')
-rw-r--r-- | launcher/ui/widgets/LogView.h | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/launcher/ui/widgets/LogView.h b/launcher/ui/widgets/LogView.h new file mode 100644 index 00000000..3143360a --- /dev/null +++ b/launcher/ui/widgets/LogView.h @@ -0,0 +1,36 @@ +#pragma once +#include <QPlainTextEdit> +#include <QAbstractItemView> + +class QAbstractItemModel; + +class LogView: public QPlainTextEdit +{ + Q_OBJECT +public: + explicit LogView(QWidget *parent = nullptr); + virtual ~LogView(); + + virtual void setModel(QAbstractItemModel *model); + QAbstractItemModel *model() const; + +public slots: + void setWordWrap(bool wrapping); + void findNext(const QString & what, bool reverse); + void scrollToBottom(); + +protected slots: + void repopulate(); + // note: this supports only appending + void rowsInserted(const QModelIndex &parent, int first, int last); + void rowsAboutToBeInserted(const QModelIndex &parent, int first, int last); + // note: this supports only removing from front + void rowsRemoved(const QModelIndex &parent, int first, int last); + void modelDestroyed(QObject * model); + +protected: + QAbstractItemModel *m_model = nullptr; + QTextCharFormat *m_defaultFormat = nullptr; + bool m_scroll = false; + bool m_scrolling = false; +}; |