LibreOffice Module vcl (master) 1
qt5/QtWidget.hxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 *
9 * This file incorporates work covered by the following license notice:
10 *
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 */
19
20#pragma once
21
22#include <QtCore/QRect>
23#include <QtWidgets/QWidget>
24#include <rtl/ustring.hxx>
25
26#include <com/sun/star/uno/Reference.hxx>
27#include <com/sun/star/accessibility/XAccessibleEditableText.hpp>
28
29class QInputEvent;
30class QtFrame;
31class QtObject;
33
34class QtWidget : public QWidget
35{
36 Q_OBJECT
37
41 mutable QRect m_aImCursorRectangle;
44
45 static void commitText(QtFrame&, const QString& aText);
46 static void deleteReplacementText(QtFrame& rFrame, int nReplacementStart,
47 int nReplacementLength);
48 static bool handleKeyEvent(QtFrame&, const QWidget&, QKeyEvent*);
49 static void handleMouseEnterLeaveEvents(const QtFrame&, QEvent*);
50 static void fillSalAbstractMouseEvent(const QtFrame& rFrame, const QInputEvent* pQEvent,
51 const QPoint& rPos, Qt::MouseButtons eButtons, int nWidth,
52 SalAbstractMouseEvent& aSalEvent);
53
54 virtual bool event(QEvent*) override;
55
56 virtual void focusInEvent(QFocusEvent*) override;
57 virtual void focusOutEvent(QFocusEvent*) override;
58 // keyPressEvent(QKeyEvent*) is handled via event(QEvent*); see comment
59 virtual void keyReleaseEvent(QKeyEvent*) override;
60 virtual void mouseMoveEvent(QMouseEvent*) override;
61 virtual void mousePressEvent(QMouseEvent*) override;
62 virtual void mouseReleaseEvent(QMouseEvent*) override;
63 virtual void dragEnterEvent(QDragEnterEvent*) override;
64 virtual void dragLeaveEvent(QDragLeaveEvent*) override;
65 virtual void dragMoveEvent(QDragMoveEvent*) override;
66 virtual void dropEvent(QDropEvent*) override;
67 virtual void moveEvent(QMoveEvent*) override;
68 virtual void paintEvent(QPaintEvent*) override;
69 virtual void resizeEvent(QResizeEvent*) override;
70 virtual void showEvent(QShowEvent*) override;
71 virtual void hideEvent(QHideEvent*) override;
72 virtual void wheelEvent(QWheelEvent*) override;
73 virtual void closeEvent(QCloseEvent*) override;
74 virtual void changeEvent(QEvent*) override;
75 virtual void leaveEvent(QEvent*) override;
76#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
77 virtual void enterEvent(QEnterEvent*) override;
78#else
79 virtual void enterEvent(QEvent*) override;
80#endif
81
82 void inputMethodEvent(QInputMethodEvent*) override;
83 QVariant inputMethodQuery(Qt::InputMethodQuery) const override;
84 static void closePopup();
85
86public:
87 QtWidget(QtFrame& rFrame, Qt::WindowFlags f = Qt::WindowFlags());
88
89 QtFrame& frame() const { return m_rFrame; }
91 void fakeResize();
92
93 static bool handleEvent(QtFrame&, QWidget&, QEvent*);
94 // key events might be propagated further down => call base on false
95 static inline bool handleKeyReleaseEvent(QtFrame&, const QWidget&, QKeyEvent*);
96 // mouse events are always accepted
97 static void handleMouseButtonEvent(const QtFrame&, const QMouseEvent*);
98};
99
100bool QtWidget::handleKeyReleaseEvent(QtFrame& rFrame, const QWidget& rWidget, QKeyEvent* pEvent)
101{
102 return handleKeyEvent(rFrame, rWidget, pEvent);
103}
104
105/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
void endExtTextInput()
bool m_bInInputMethodQueryCursorRectangle
virtual void paintEvent(QPaintEvent *) override
virtual void showEvent(QShowEvent *) override
static void commitText(QtFrame &, const QString &aText)
QVariant inputMethodQuery(Qt::InputMethodQuery) const override
virtual void wheelEvent(QWheelEvent *) override
QtFrame & m_rFrame
virtual void dragLeaveEvent(QDragLeaveEvent *) override
static void fillSalAbstractMouseEvent(const QtFrame &rFrame, const QInputEvent *pQEvent, const QPoint &rPos, Qt::MouseButtons eButtons, int nWidth, SalAbstractMouseEvent &aSalEvent)
static void handleMouseButtonEvent(const QtFrame &, const QMouseEvent *)
static bool handleKeyEvent(QtFrame &, const QWidget &, QKeyEvent *)
static bool handleKeyReleaseEvent(QtFrame &, const QWidget &, QKeyEvent *)
static void closePopup()
bool m_bNonEmptyIMPreeditSeen
virtual void dropEvent(QDropEvent *) override
virtual void mouseMoveEvent(QMouseEvent *) override
QtFrame & frame() const
static void handleMouseEnterLeaveEvents(const QtFrame &, QEvent *)
virtual void enterEvent(QEnterEvent *) override
static void deleteReplacementText(QtFrame &rFrame, int nReplacementStart, int nReplacementLength)
virtual void dragEnterEvent(QDragEnterEvent *) override
virtual void focusOutEvent(QFocusEvent *) override
virtual void focusInEvent(QFocusEvent *) override
QtWidget(QtFrame &rFrame, Qt::WindowFlags f=Qt::WindowFlags())
virtual void keyReleaseEvent(QKeyEvent *) override
virtual void hideEvent(QHideEvent *) override
virtual void mouseReleaseEvent(QMouseEvent *) override
virtual void leaveEvent(QEvent *) override
virtual void closeEvent(QCloseEvent *) override
virtual bool event(QEvent *) override
virtual void moveEvent(QMoveEvent *) override
virtual void changeEvent(QEvent *) override
void fakeResize()
virtual void mousePressEvent(QMouseEvent *) override
virtual void dragMoveEvent(QDragMoveEvent *) override
virtual void resizeEvent(QResizeEvent *) override
QRect m_aImCursorRectangle
void inputMethodEvent(QInputMethodEvent *) override
static bool handleEvent(QtFrame &, QWidget &, QEvent *)