Drawing a vertical line on a QPlainTextEdit?
Solved
General and Desktop
-
Hi
Sure it is. Fast sample. Note. using fixed numbers. you want to use viewport()->height() etc.#ifndef MYTEXT_H #define MYTEXT_H #include <QPainter> #include <QPlainTextEdit> class MyText : public QPlainTextEdit { Q_OBJECT public: explicit MyText(QWidget *parent = nullptr) : QPlainTextEdit(parent) {} protected: virtual void paintEvent(QPaintEvent *event) override { QPlainTextEdit::paintEvent(event); QPainter p(viewport()); // note we use viewport as its the one that actually draws p.drawLine(100, 0, 100, 1000); } }; #endif // MYTEXT_H