tdf#125606 Qt5 directly show tooltips + respect the help area
I'm not sure why this redirection was implemented, which also ommited
the provided help area. I tried hard to use vc::Window code in the
beginning, but that also mirrors the cursor position for the window.
Using Qt here is simply straight forward, so just do that,
Reviewed-on: https://gerrit.libreoffice.org/74548
Tested-by: Jenkins
Reviewed-by: Jan-Marek Glogowski <glogow@fbihome.de>
(cherry picked from commit ab5f341efd144adb6b7d0e00fece76a2153acd10)
Reviewed-on: https://gerrit.libreoffice.org/74571
(cherry picked from commit e3988fa785c0430ae708527cbc5a7baa6d9d55a6)
Change-Id: Ia8c4efc1e43b915c4b071ee26d4da37d7580817c
Reviewed-on: https://gerrit.libreoffice.org/74854
Tested-by: Jenkins
Reviewed-by: Katarina Behrens <Katarina.Behrens@cib.de>
diff --git a/vcl/inc/qt5/Qt5Frame.hxx b/vcl/inc/qt5/Qt5Frame.hxx
index 58b72e4..a666f18 100644
--- a/vcl/inc/qt5/Qt5Frame.hxx
+++ b/vcl/inc/qt5/Qt5Frame.hxx
@@ -135,9 +135,6 @@
private:
void setVisible(bool);
Q_SIGNALS:
void tooltipRequest(const OUString& rTooltip);
public:
Qt5Frame(Qt5Frame* pParent, SalFrameStyleFlags nSalFrameStyle, bool bUseCairo);
virtual ~Qt5Frame() override;
diff --git a/vcl/inc/qt5/Qt5Widget.hxx b/vcl/inc/qt5/Qt5Widget.hxx
index 30998a8..0b98826 100644
--- a/vcl/inc/qt5/Qt5Widget.hxx
+++ b/vcl/inc/qt5/Qt5Widget.hxx
@@ -68,9 +68,6 @@
void inputMethodEvent(QInputMethodEvent*) override;
QVariant inputMethodQuery(Qt::InputMethodQuery) const override;
public slots:
static void showTooltip(const OUString& rTip);
public:
Qt5Widget(Qt5Frame& rFrame, Qt::WindowFlags f = Qt::WindowFlags());
diff --git a/vcl/qt5/Qt5Frame.cxx b/vcl/qt5/Qt5Frame.cxx
index 1ded558..761f77d 100644
--- a/vcl/qt5/Qt5Frame.cxx
+++ b/vcl/qt5/Qt5Frame.cxx
@@ -159,9 +159,6 @@
else
m_pQWidget = new Qt5Widget(*this, aWinFlags);
connect(this, &Qt5Frame::tooltipRequest, static_cast<Qt5Widget*>(m_pQWidget),
&Qt5Widget::showTooltip);
if (pParent && !(pParent->m_nStyle & SalFrameStyleFlags::PLUG))
{
QWindow* pParentWindow = pParent->GetQWidget()->window()->windowHandle();
@@ -783,9 +780,12 @@
// destroyed, so that state should be safely flushed.
}
bool Qt5Frame::ShowTooltip(const OUString& rText, const tools::Rectangle& /*rHelpArea*/)
bool Qt5Frame::ShowTooltip(const OUString& rText, const tools::Rectangle& rHelpArea)
{
emit tooltipRequest(rText);
QRect aHelpArea(toQRect(rHelpArea));
if (QGuiApplication::isRightToLeft())
aHelpArea.moveLeft(maGeometry.nWidth - aHelpArea.width() - aHelpArea.left() - 1);
QToolTip::showText(QCursor::pos(), toQString(rText), m_pQWidget, aHelpArea);
return true;
}
diff --git a/vcl/qt5/Qt5Widget.cxx b/vcl/qt5/Qt5Widget.cxx
index 44b62c4..a5354c5 100644
--- a/vcl/qt5/Qt5Widget.cxx
+++ b/vcl/qt5/Qt5Widget.cxx
@@ -38,7 +38,6 @@
#include <QtGui/QTextCharFormat>
#include <QtGui/QWheelEvent>
#include <QtWidgets/QMainWindow>
#include <QtWidgets/QToolTip>
#include <QtWidgets/QWidget>
#include <cairo.h>
@@ -431,12 +430,6 @@
void Qt5Widget::focusOutEvent(QFocusEvent*) { m_rFrame.CallCallback(SalEvent::LoseFocus, nullptr); }
void Qt5Widget::showTooltip(const OUString& rTooltip)
{
QPoint pt = QCursor::pos();
QToolTip::showText(pt, toQString(rTooltip));
}
Qt5Widget::Qt5Widget(Qt5Frame& rFrame, Qt::WindowFlags f)
: QWidget(Q_NULLPTR, f)
, m_rFrame(rFrame)