summaryrefslogtreecommitdiff
path: root/vcl/inc
diff options
context:
space:
mode:
authorMichael Weghorn <m.weghorn@posteo.de>2024-11-06 21:51:46 +0100
committerMichael Weghorn <m.weghorn@posteo.de>2024-11-07 09:53:43 +0100
commit5c85ef3df01daf7848753fe33f254aeb3d1dd8e6 (patch)
tree80511634578a9a624c01bf93d62981fda899ff1d /vcl/inc
parent2d1de12ac8064dd3c73e4359b931fdccae3541fb (diff)
tdf#130857 qt weld: Add QtInstanceDrawingArea basics
Add a new QtInstanceDrawingArea class as the weld::DrawingArea implementation using native Qt widgets. Initially only add the "basic structure" (most of the actual functionality of drawing will be added separately): * Add the QtInstanceDrawingArea class with most methods currently still unimplemented and triggering an assert when they get called. * Add a `ScopedVclPtrInstance<VirtualDevice> m_xDevice` member and return that in `QtInstanceDrawingArea::get_ref_device`, as the gtk3 implementation (GtkInstanceDrawingArea) does. * Let QtBuilder::makeObject create a QLabel for a "GtkDrawingArea" object for now. That label will hold a pixmap (which should be sufficient for simple cases at least). * Let QtInstanceBuilder::weld_drawing_area return an instance of the new class. Change-Id: I5d509ccd9f5a7a826a166958af4a92ff01cc0225 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/176171 Reviewed-by: Michael Weghorn <m.weghorn@posteo.de> Tested-by: Jenkins
Diffstat (limited to 'vcl/inc')
-rw-r--r--vcl/inc/qt5/QtInstanceDrawingArea.hxx52
-rw-r--r--vcl/inc/qt6/QtInstanceDrawingArea.hxx12
2 files changed, 64 insertions, 0 deletions
diff --git a/vcl/inc/qt5/QtInstanceDrawingArea.hxx b/vcl/inc/qt5/QtInstanceDrawingArea.hxx
new file mode 100644
index 000000000000..757174330c13
--- /dev/null
+++ b/vcl/inc/qt5/QtInstanceDrawingArea.hxx
@@ -0,0 +1,52 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#pragma once
+
+#include "QtInstanceWidget.hxx"
+
+#include <QtWidgets/QLabel>
+
+class QtInstanceDrawingArea : public QObject,
+ public QtInstanceWidget,
+ public virtual weld::DrawingArea
+{
+ Q_OBJECT
+
+ QLabel* m_pLabel;
+ ScopedVclPtrInstance<VirtualDevice> m_xDevice;
+
+public:
+ QtInstanceDrawingArea(QLabel* pLabel);
+
+ virtual void queue_draw() override;
+ virtual void queue_draw_area(int x, int y, int width, int height) override;
+
+ virtual void enable_drag_source(rtl::Reference<TransferDataContainer>& rTransferable,
+ sal_uInt8 eDNDConstants) override;
+
+ virtual void set_cursor(PointerStyle ePointerStyle) override;
+
+ virtual Point get_pointer_position() const override;
+
+ virtual void set_input_context(const InputContext& rInputContext) override;
+ virtual void im_context_set_cursor_location(const tools::Rectangle& rCursorRect,
+ int nExtTextInputWidth) override;
+
+ virtual OutputDevice& get_ref_device() override;
+
+ virtual a11yref get_accessible_parent() override;
+ virtual a11yrelationset get_accessible_relation_set() override;
+ virtual AbsoluteScreenPixelPoint get_accessible_location_on_screen() override;
+
+private:
+ virtual void click(const Point&) override;
+};
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/inc/qt6/QtInstanceDrawingArea.hxx b/vcl/inc/qt6/QtInstanceDrawingArea.hxx
new file mode 100644
index 000000000000..00c19b649c0f
--- /dev/null
+++ b/vcl/inc/qt6/QtInstanceDrawingArea.hxx
@@ -0,0 +1,12 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#include "../qt5/QtInstanceDrawingArea.hxx"
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */