diff options
author | Jan-Marek Glogowski <glogow@fbihome.de> | 2019-06-22 02:25:24 +0200 |
---|---|---|
committer | Katarina Behrens <Katarina.Behrens@cib.de> | 2019-06-29 09:38:10 +0200 |
commit | 9ed060d38fd8dc85bebccbc735bce8bf66a89df4 (patch) | |
tree | 2a7efa0e703e9978c1292bd6e0fe5feef6fd6d24 | |
parent | c5e8780391acb1f9fd72f8956438a79dfa64ca53 (diff) |
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>
-rw-r--r-- | vcl/inc/qt5/Qt5Frame.hxx | 3 | ||||
-rw-r--r-- | vcl/inc/qt5/Qt5Widget.hxx | 3 | ||||
-rw-r--r-- | vcl/qt5/Qt5Frame.cxx | 10 | ||||
-rw-r--r-- | vcl/qt5/Qt5Widget.cxx | 7 |
4 files changed, 5 insertions, 18 deletions
diff --git a/vcl/inc/qt5/Qt5Frame.hxx b/vcl/inc/qt5/Qt5Frame.hxx index 58b72e484afe..a666f18e0a41 100644 --- a/vcl/inc/qt5/Qt5Frame.hxx +++ b/vcl/inc/qt5/Qt5Frame.hxx @@ -135,9 +135,6 @@ class VCLPLUG_QT5_PUBLIC Qt5Frame : public QObject, public SalFrame 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 30998a8a1c6d..0b988269afe6 100644 --- a/vcl/inc/qt5/Qt5Widget.hxx +++ b/vcl/inc/qt5/Qt5Widget.hxx @@ -68,9 +68,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 1ded558d0664..761f77dae3b5 100644 --- a/vcl/qt5/Qt5Frame.cxx +++ b/vcl/qt5/Qt5Frame.cxx @@ -159,9 +159,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(); @@ -783,9 +780,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 44b62c48150d..a5354c5144e1 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::focusInEvent(QFocusEvent*) { m_rFrame.CallCallback(SalEvent::Get 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) |