vcl/inc/qt5/QtWidget.hxx | 10 +--------- vcl/qt5/QtWidget.cxx | 19 ++++++++----------- 2 files changed, 9 insertions(+), 20 deletions(-)
New commits: commit 5b1137f08d3cc18ac79afc5e0c73e40343898181 Author: Michael Weghorn <m.wegh...@posteo.de> AuthorDate: Sat Apr 12 12:19:04 2025 +0200 Commit: Michael Weghorn <m.wegh...@posteo.de> CommitDate: Sun Apr 13 19:16:40 2025 +0200 qt: Inline QtWidget::handleKeyReleaseEvent to only caller Change-Id: I4711bfb218f2064f0c56049c0dfec9df43522223 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/184091 Reviewed-by: Michael Weghorn <m.wegh...@posteo.de> Tested-by: Jenkins diff --git a/vcl/inc/qt5/QtWidget.hxx b/vcl/inc/qt5/QtWidget.hxx index 8b09125a7047..eb176255ce71 100644 --- a/vcl/inc/qt5/QtWidget.hxx +++ b/vcl/inc/qt5/QtWidget.hxx @@ -94,14 +94,6 @@ public: QtFrame& frame() const { return m_rFrame; } void endExtTextInput(); void fakeResize(); - - // key events might be propagated further down => call base on false - static inline bool handleKeyReleaseEvent(QtFrame&, const QWidget&, QKeyEvent*); }; -bool QtWidget::handleKeyReleaseEvent(QtFrame& rFrame, const QWidget& rWidget, QKeyEvent* pEvent) -{ - return handleKeyEvent(rFrame, rWidget, pEvent); -} - /* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ diff --git a/vcl/qt5/QtWidget.cxx b/vcl/qt5/QtWidget.cxx index 0a596196a5fd..47138c2ef302 100644 --- a/vcl/qt5/QtWidget.cxx +++ b/vcl/qt5/QtWidget.cxx @@ -678,7 +678,7 @@ bool QtWidget::event(QEvent* pEvent) { return handleEvent(pEvent) || QWidget::ev void QtWidget::keyReleaseEvent(QKeyEvent* pEvent) { - if (!handleKeyReleaseEvent(m_rFrame, *this, pEvent)) + if (!handleKeyEvent(m_rFrame, *this, pEvent)) QWidget::keyReleaseEvent(pEvent); } commit a34dac1722555468121acec93616211fa58ddac5 Author: Michael Weghorn <m.wegh...@posteo.de> AuthorDate: Sat Apr 12 12:16:09 2025 +0200 Commit: Michael Weghorn <m.wegh...@posteo.de> CommitDate: Sun Apr 13 19:16:33 2025 +0200 qt: Simplify QtWidget::handleEvent Make non-static and stop passing `m_rFrame` and `this` as params in (at least by now) only caller. Change-Id: Ib001bc2a3da443dc9413a170ea7ac922399be0dd Reviewed-on: https://gerrit.libreoffice.org/c/core/+/184090 Reviewed-by: Michael Weghorn <m.wegh...@posteo.de> Tested-by: Jenkins diff --git a/vcl/inc/qt5/QtWidget.hxx b/vcl/inc/qt5/QtWidget.hxx index 3be0dfb558cf..8b09125a7047 100644 --- a/vcl/inc/qt5/QtWidget.hxx +++ b/vcl/inc/qt5/QtWidget.hxx @@ -46,6 +46,7 @@ class QtWidget : public QWidget static void commitText(QtFrame&, const QString& aText); static void deleteReplacementText(const QtFrame& rFrame, int nReplacementStart, int nReplacementLength); + bool handleEvent(QEvent* pEvent); // mouse events are always accepted void handleMouseButtonEvent(const QMouseEvent*) const; static bool handleGestureEvent(const QtFrame& rFrame, QGestureEvent* pGestureEvent); @@ -94,7 +95,6 @@ public: void endExtTextInput(); void fakeResize(); - static bool handleEvent(QtFrame&, QWidget&, QEvent*); // key events might be propagated further down => call base on false static inline bool handleKeyReleaseEvent(QtFrame&, const QWidget&, QKeyEvent*); }; diff --git a/vcl/qt5/QtWidget.cxx b/vcl/qt5/QtWidget.cxx index a00cc4257515..0a596196a5fd 100644 --- a/vcl/qt5/QtWidget.cxx +++ b/vcl/qt5/QtWidget.cxx @@ -617,12 +617,12 @@ bool QtWidget::handleKeyEvent(QtFrame& rFrame, const QWidget& rWidget, QKeyEvent return bStopProcessingKey; } -bool QtWidget::handleEvent(QtFrame& rFrame, QWidget& rWidget, QEvent* pEvent) +bool QtWidget::handleEvent(QEvent* pEvent) { if (pEvent->type() == QEvent::Gesture) { QGestureEvent* pGestureEvent = static_cast<QGestureEvent*>(pEvent); - return handleGestureEvent(rFrame, pGestureEvent); + return handleGestureEvent(m_rFrame, pGestureEvent); } else if (pEvent->type() == QEvent::ShortcutOverride) { @@ -648,7 +648,7 @@ bool QtWidget::handleEvent(QtFrame& rFrame, QWidget& rWidget, QEvent* pEvent) // and if it's handled - disable the shortcut, it should have been activated. // Don't process keyPressEvent generated after disabling shortcut since it was handled here. // If event is not handled, don't accept it and let Qt activate related shortcut. - if (handleKeyEvent(rFrame, rWidget, static_cast<QKeyEvent*>(pEvent))) + if (handleKeyEvent(m_rFrame, *this, static_cast<QKeyEvent*>(pEvent))) return true; } else if (pEvent->type() == QEvent::ToolTip) @@ -656,13 +656,13 @@ bool QtWidget::handleEvent(QtFrame& rFrame, QWidget& rWidget, QEvent* pEvent) // Qt's POV on the active popup is wrong due to our fake popup, so check LO's state. // Otherwise Qt will continue handling ToolTip events from the "parent" window. const QtFrame* pPopupFrame = GetQtInstance().activePopup(); - if (!rFrame.m_aTooltipText.isEmpty() && (!pPopupFrame || pPopupFrame == &rFrame)) + if (!m_rFrame.m_aTooltipText.isEmpty() && (!pPopupFrame || pPopupFrame == &m_rFrame)) { // tdf#162297 Use a dummy style to ensure the tooltip is wrapped QString sTooltipText("<font font-weight=normal>"); - sTooltipText += toQString(rFrame.m_aTooltipText); + sTooltipText += toQString(m_rFrame.m_aTooltipText); sTooltipText += "</font>"; - QToolTip::showText(QCursor::pos(), sTooltipText, &rWidget, rFrame.m_aTooltipArea); + QToolTip::showText(QCursor::pos(), sTooltipText, this, m_rFrame.m_aTooltipArea); } else { @@ -674,10 +674,7 @@ bool QtWidget::handleEvent(QtFrame& rFrame, QWidget& rWidget, QEvent* pEvent) return false; } -bool QtWidget::event(QEvent* pEvent) -{ - return handleEvent(m_rFrame, *this, pEvent) || QWidget::event(pEvent); -} +bool QtWidget::event(QEvent* pEvent) { return handleEvent(pEvent) || QWidget::event(pEvent); } void QtWidget::keyReleaseEvent(QKeyEvent* pEvent) {