/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */ /* * This file is part of the LibreOffice project. * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. *
*/
namespace
{ /** QtMimeData subclass that ensures that at least one MIME type is * reported (using a dummy one if necessary), to prevent drag and drop * operations on Wayland from getting cancelled (see tdf#164380).
*/ class QtDragMimeData : public QtMimeData
{ public: explicit QtDragMimeData(const css::uno::Reference<css::datatransfer::XTransferable>& rContents)
: QtMimeData(rContents)
{
}
if (m_pFrame)
{
QDrag* drag = new QDrag(m_pFrame->GetQWidget());
drag->setMimeData(new QtDragMimeData(rTrans)); // just a reminder that exec starts a nested event loop, so everything after // this call is just executed, after D'n'D has finished!
drag->exec(toQtDropActions(sourceActions), getPreferredDropAction(sourceActions));
}
// the drop will eventually call fire_dragEnd, which will clear the listener. // if D'n'D ends without success, we just get a leave event without any indicator, // but the event loop will be terminated, so we have to try to inform the source of // a failure in any way.
fire_dragEnd(datatransfer::dnd::DNDConstants::ACTION_NONE, false);
}
void QtDragSource::fire_dragEnd(sal_Int8 nAction, bool bDropSuccessful)
{ if (!m_xListener.is()) return;
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.