vcl/inc/qt5/QtDragAndDrop.hxx | 2 +- vcl/qt5/QtDragAndDrop.cxx | 6 +----- vcl/qt5/QtFrame.cxx | 16 ++++++++-------- vcl/qt5/QtInstance.cxx | 9 ++++++--- 4 files changed, 16 insertions(+), 17 deletions(-)
New commits: commit 9c9e53d3bacb29c2e21c447bfe0c8df581e89250 Author: Michael Weghorn <m.wegh...@posteo.de> AuthorDate: Tue Jul 1 16:39:11 2025 +0200 Commit: Michael Weghorn <m.wegh...@posteo.de> CommitDate: Tue Jul 1 20:05:43 2025 +0200 qt: Drop unnecessary QPoint -> Point conversions Change-Id: I3e4219b9642307cacd23f1f67e8c2aaa43a3afb6 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/187244 Reviewed-by: Michael Weghorn <m.wegh...@posteo.de> Tested-by: Jenkins diff --git a/vcl/qt5/QtFrame.cxx b/vcl/qt5/QtFrame.cxx index d57b98eb2fc3..4eec1f266124 100644 --- a/vcl/qt5/QtFrame.cxx +++ b/vcl/qt5/QtFrame.cxx @@ -1409,16 +1409,16 @@ void QtFrame::handleDragMove(QDragMoveEvent* pEvent) const sal_Int8 nUserDropAction = lcl_getUserDropAction(pEvent, nSourceActions, pMimeData); #if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) - const Point aPos = toPoint(pEvent->position().toPoint() * devicePixelRatioF()); + const QPoint aPos = pEvent->position().toPoint() * devicePixelRatioF(); #else - const Point aPos = toPoint(pEvent->pos() * devicePixelRatioF()); + const QPoint aPos = pEvent->pos() * devicePixelRatioF(); #endif css::datatransfer::dnd::DropTargetDragEnterEvent aEvent; aEvent.Source = static_cast<css::datatransfer::dnd::XDropTarget*>(m_pDropTarget); aEvent.Context = static_cast<css::datatransfer::dnd::XDropTargetDragContext*>(m_pDropTarget); - aEvent.LocationX = aPos.X(); - aEvent.LocationY = aPos.Y(); + aEvent.LocationX = aPos.x(); + aEvent.LocationY = aPos.y(); aEvent.DropAction = nUserDropAction; aEvent.SourceActions = nSourceActions; @@ -1452,16 +1452,16 @@ void QtFrame::handleDrop(QDropEvent* pEvent) = lcl_getUserDropAction(pEvent, nSourceActions, pEvent->mimeData()); #if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) - const Point aPos = toPoint(pEvent->position().toPoint() * devicePixelRatioF()); + const QPoint aPos = pEvent->position().toPoint() * devicePixelRatioF(); #else - const Point aPos = toPoint(pEvent->pos() * devicePixelRatioF()); + const QPoint aPos = pEvent->pos() * devicePixelRatioF(); #endif css::datatransfer::dnd::DropTargetDropEvent aEvent; aEvent.Source = static_cast<css::datatransfer::dnd::XDropTarget*>(m_pDropTarget); aEvent.Context = static_cast<css::datatransfer::dnd::XDropTargetDropContext*>(m_pDropTarget); - aEvent.LocationX = aPos.X(); - aEvent.LocationY = aPos.Y(); + aEvent.LocationX = aPos.x(); + aEvent.LocationY = aPos.y(); aEvent.SourceActions = nSourceActions; aEvent.DropAction = nUserDropAction; aEvent.Transferable = lcl_getXTransferable(pEvent->mimeData()); commit 2583f8605546aca8ea6568ebacc86b0c78bffd31 Author: Michael Weghorn <m.wegh...@posteo.de> AuthorDate: Tue Jul 1 16:15:15 2025 +0200 Commit: Michael Weghorn <m.wegh...@posteo.de> CommitDate: Tue Jul 1 20:05:37 2025 +0200 tdf#130857 qt: No longer pass QtFrame to QtDropTarget ctor Instead, move the logic specific to QtFrame to QtInstance::ImplCreateDropTarget. This prepares for reusing QtDropTarget for QtInstanceWidget::get_drop_target. Change-Id: If0f24b03222799d9946e3f780388a6e9ebd5a024 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/187243 Reviewed-by: Michael Weghorn <m.wegh...@posteo.de> Tested-by: Jenkins diff --git a/vcl/inc/qt5/QtDragAndDrop.hxx b/vcl/inc/qt5/QtDragAndDrop.hxx index aeef85083a5b..b6bfb0188ac8 100644 --- a/vcl/inc/qt5/QtDragAndDrop.hxx +++ b/vcl/inc/qt5/QtDragAndDrop.hxx @@ -68,7 +68,7 @@ class QtDropTarget final bool m_bDropSuccessful; public: - QtDropTarget(QtFrame* pFrame); + QtDropTarget(); virtual ~QtDropTarget() override; // XDropTarget diff --git a/vcl/qt5/QtDragAndDrop.cxx b/vcl/qt5/QtDragAndDrop.cxx index 03b1214da847..ecc967e1dc15 100644 --- a/vcl/qt5/QtDragAndDrop.cxx +++ b/vcl/qt5/QtDragAndDrop.cxx @@ -113,16 +113,12 @@ css::uno::Sequence<OUString> SAL_CALL QtDragSource::getSupportedServiceNames() return { u"com.sun.star.datatransfer.dnd.QtDragSource"_ustr }; } -QtDropTarget::QtDropTarget(QtFrame* pFrame) +QtDropTarget::QtDropTarget() : WeakComponentImplHelper(m_aMutex) , m_nDropAction(datatransfer::dnd::DNDConstants::ACTION_NONE) , m_bActive(false) , m_nDefaultActions(0) { - assert(pFrame && "missing SalFrame"); - - pFrame->registerDropTarget(this); - m_bActive = true; } OUString SAL_CALL QtDropTarget::getImplementationName() diff --git a/vcl/qt5/QtInstance.cxx b/vcl/qt5/QtInstance.cxx index 34692e7a719e..2e5cb4368f06 100644 --- a/vcl/qt5/QtInstance.cxx +++ b/vcl/qt5/QtInstance.cxx @@ -665,9 +665,12 @@ QtInstance::ImplCreateDragSource(const SystemEnvData* pSysEnv) css::uno::Reference<css::datatransfer::dnd::XDropTarget> QtInstance::ImplCreateDropTarget(const SystemEnvData* pSysEnv) { - css::uno::Reference<css::datatransfer::dnd::XDropTarget> xRet - = new QtDropTarget(static_cast<QtFrame*>(pSysEnv->pSalFrame)); - return xRet; + rtl::Reference<QtDropTarget> pDropTarget = new QtDropTarget; + QtFrame* pFrame = static_cast<QtFrame*>(pSysEnv->pSalFrame); + pFrame->registerDropTarget(pDropTarget.get()); + pDropTarget->setActive(true); + + return pDropTarget; } const cairo_font_options_t* QtInstance::GetCairoFontOptions()