[Libreoffice-commits] core.git: Branch 'libreoffice-6-3' - vcl/inc vcl/qt5

Jan-Marek Glogowski (via logerrit) logerrit at kemper.freedesktop.org
Sat Jun 22 18:17:57 UTC 2019


 vcl/inc/qt5/Qt5Frame.hxx  |    3 ---
 vcl/inc/qt5/Qt5Widget.hxx |    3 ---
 vcl/qt5/Qt5Frame.cxx      |   10 +++++-----
 vcl/qt5/Qt5Widget.cxx     |    7 -------
 4 files changed, 5 insertions(+), 18 deletions(-)

New commits:
commit e3988fa785c0430ae708527cbc5a7baa6d9d55a6
Author:     Jan-Marek Glogowski <glogow at fbihome.de>
AuthorDate: Sat Jun 22 02:25:24 2019 +0200
Commit:     Jan-Marek Glogowski <glogow at fbihome.de>
CommitDate: Sat Jun 22 20:17:19 2019 +0200

    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,
    
    Change-Id: Ia8c4efc1e43b915c4b071ee26d4da37d7580817c
    Reviewed-on: https://gerrit.libreoffice.org/74548
    Tested-by: Jenkins
    Reviewed-by: Jan-Marek Glogowski <glogow at fbihome.de>
    (cherry picked from commit ab5f341efd144adb6b7d0e00fece76a2153acd10)
    Reviewed-on: https://gerrit.libreoffice.org/74571

diff --git a/vcl/inc/qt5/Qt5Frame.hxx b/vcl/inc/qt5/Qt5Frame.hxx
index d7f8f1aa6e1f..5b1bc1025445 100644
--- a/vcl/inc/qt5/Qt5Frame.hxx
+++ b/vcl/inc/qt5/Qt5Frame.hxx
@@ -133,9 +133,6 @@ class VCLPLUG_QT5_PUBLIC Qt5Frame : public QObject, public SalFrame
     void TriggerPaintEvent();
     void TriggerPaintEvent(QRect aRect);
 
-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 8ead4b3ec945..85523951cda2 100644
--- a/vcl/inc/qt5/Qt5Widget.hxx
+++ b/vcl/inc/qt5/Qt5Widget.hxx
@@ -70,9 +70,6 @@ class Qt5Widget : public QWidget
     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 b009847456e7..20cb4483295c 100644
--- a/vcl/qt5/Qt5Frame.cxx
+++ b/vcl/qt5/Qt5Frame.cxx
@@ -155,9 +155,6 @@ Qt5Frame::Qt5Frame(Qt5Frame* pParent, SalFrameStyleFlags nStyle, bool bUseCairo)
     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();
@@ -743,9 +740,12 @@ void Qt5Frame::Flush()
     // 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 3b4c114a0a45..8dca7aa03001 100644
--- a/vcl/qt5/Qt5Widget.cxx
+++ b/vcl/qt5/Qt5Widget.cxx
@@ -40,7 +40,6 @@
 #include <QtGui/QTextCharFormat>
 #include <QtGui/QWheelEvent>
 #include <QtWidgets/QMainWindow>
-#include <QtWidgets/QToolTip>
 #include <QtWidgets/QWidget>
 
 #include <cairo.h>
@@ -502,12 +501,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)


More information about the Libreoffice-commits mailing list