summaryrefslogtreecommitdiffhomepage
path: root/example/text_processor_example/qt_widget.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'example/text_processor_example/qt_widget.hpp')
-rw-r--r--example/text_processor_example/qt_widget.hpp50
1 files changed, 50 insertions, 0 deletions
diff --git a/example/text_processor_example/qt_widget.hpp b/example/text_processor_example/qt_widget.hpp
new file mode 100644
index 0000000..60777e6
--- /dev/null
+++ b/example/text_processor_example/qt_widget.hpp
@@ -0,0 +1,50 @@
+/*
+ * File: qt_widget.hpp
+ * Purpose: Minimal text editor widget example using tproc rope.
+ * Author: Amlal El Mahrouss (amlal@nekernel.org)
+ * Copyright 2026, Amlal El Mahrouss, licensed under the Boost Software License.
+ */
+
+#ifndef TPROC_EXAMPLE_QT_WIDGET_HPP
+#define TPROC_EXAMPLE_QT_WIDGET_HPP
+
+#include <ocl/tproc/rope.hpp>
+
+#include <iostream>
+#include <string>
+#include <string_view>
+#include <QWidget>
+#include <QApplication>
+
+#ifndef STANDALONE
+
+using namespace ocl;
+using namespace boost;
+
+#else
+
+using namespace boost;
+
+#endif
+
+class TTextEditorWidget : public QWidget
+{
+ Q_OBJECT
+
+public:
+ using rope_type = tproc::crope;
+ using size_type = rope_type::size_type;
+ using string_view = std::string_view;
+
+ TTextEditorWidget(string_view text = {})
+ : buffer_(text)
+ {
+ }
+
+ virtual ~TTextEditorWidget() = default;
+
+private:
+ rope_type buffer_;
+};
+
+#endif