summaryrefslogtreecommitdiffstats
path: root/tests/manual/qglyphruns/view.h
diff options
context:
space:
mode:
Diffstat (limited to 'tests/manual/qglyphruns/view.h')
-rw-r--r--tests/manual/qglyphruns/view.h42
1 files changed, 42 insertions, 0 deletions
diff --git a/tests/manual/qglyphruns/view.h b/tests/manual/qglyphruns/view.h
new file mode 100644
index 0000000000..a8c3c1aed9
--- /dev/null
+++ b/tests/manual/qglyphruns/view.h
@@ -0,0 +1,42 @@
+// Copyright (C) 2022 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+#ifndef VIEW_H
+#define VIEW_H
+
+#include <QWidget>
+#include <QTextOption>
+
+class QTextLayout;
+class View : public QWidget
+{
+ Q_OBJECT
+public:
+ explicit View(QWidget *parent = nullptr);
+ ~View() override;
+
+ void updateLayout(const QString &sourceString,
+ float width,
+ QTextOption::WrapMode mode,
+ const QFont &font);
+
+ QSize sizeHint() const override;
+
+ QTextLayout *layout() const { return m_layout; }
+
+public slots:
+ void setVisualizedBounds(const QRegion &region)
+ {
+ m_bounds = region;
+ update();
+ }
+
+protected:
+ void paintEvent(QPaintEvent *e) override;
+
+private:
+ QTextLayout *m_layout = nullptr;
+ QRegion m_bounds;
+};
+
+#endif // VIEW_H