本文整理汇总了C++中QDrag::supportedActions方法的典型用法代码示例。如果您正苦于以下问题:C++ QDrag::supportedActions方法的具体用法?C++ QDrag::supportedActions怎么用?C++ QDrag::supportedActions使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QDrag
的用法示例。
在下文中一共展示了QDrag::supportedActions方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: data_device_enter
void QWaylandDataDevice::data_device_enter(uint32_t serial, wl_surface *surface, wl_fixed_t x, wl_fixed_t y, wl_data_offer *id)
{
m_enterSerial = serial;
m_dragWindow = QWaylandWindow::fromWlSurface(surface)->window();
m_dragPoint = QPoint(wl_fixed_to_int(x), wl_fixed_to_int(y));
QDrag *drag = static_cast<QWaylandDrag *>(QGuiApplicationPrivate::platformIntegration()->drag())->currentDrag();
QMimeData *dragData;
Qt::DropActions supportedActions;
if (drag) {
dragData = drag->mimeData();
supportedActions = drag->supportedActions();
} else {
m_dragOffer.reset(static_cast<QWaylandDataOffer *>(wl_data_offer_get_user_data(id)));
if (m_dragOffer) {
dragData = m_dragOffer->mimeData();
supportedActions = Qt::CopyAction | Qt::MoveAction | Qt::LinkAction;
}
}
const QPlatformDragQtResponse &response = QWindowSystemInterface::handleDrag(m_dragWindow, dragData, m_dragPoint, supportedActions);
if (drag) {
static_cast<QWaylandDrag *>(QGuiApplicationPrivate::platformIntegration()->drag())->setResponse(response);
} else {
if (response.isAccepted()) {
wl_data_offer_accept(m_dragOffer->object(), m_enterSerial, m_dragOffer->firstFormat().toUtf8().constData());
} else {
wl_data_offer_accept(m_dragOffer->object(), m_enterSerial, 0);
}
}
}
示例2: data_device_motion
void QWaylandDataDevice::data_device_motion(uint32_t time, wl_fixed_t x, wl_fixed_t y)
{
Q_UNUSED(time);
QDrag *drag = static_cast<QWaylandDrag *>(QGuiApplicationPrivate::platformIntegration()->drag())->currentDrag();
if (!drag && !m_dragOffer)
return;
m_dragPoint = QPoint(wl_fixed_to_int(x), wl_fixed_to_int(y));
QMimeData *dragData;
Qt::DropActions supportedActions;
if (drag) {
dragData = drag->mimeData();
supportedActions = drag->supportedActions();
} else {
dragData = m_dragOffer->mimeData();
supportedActions = Qt::CopyAction | Qt::MoveAction | Qt::LinkAction;
}
QPlatformDragQtResponse response = QWindowSystemInterface::handleDrag(m_dragWindow, dragData, m_dragPoint, supportedActions);
if (drag) {
static_cast<QWaylandDrag *>(QGuiApplicationPrivate::platformIntegration()->drag())->setResponse(response);
} else {
if (response.isAccepted()) {
wl_data_offer_accept(m_dragOffer->object(), m_enterSerial, m_dragOffer->firstFormat().toUtf8().constData());
} else {
wl_data_offer_accept(m_dragOffer->object(), m_enterSerial, 0);
}
}
}
示例3: data_device_drop
void QWaylandDataDevice::data_device_drop()
{
QDrag *drag = static_cast<QWaylandDrag *>(QGuiApplicationPrivate::platformIntegration()->drag())->currentDrag();
qDebug() << Q_FUNC_INFO << drag << m_dragOffer.data();
QMimeData *dragData = 0;
Qt::DropActions supportedActions;
if (drag) {
dragData = drag->mimeData();
supportedActions = drag->supportedActions();
} else if (m_dragOffer) {
dragData = m_dragOffer->mimeData();
supportedActions = Qt::CopyAction | Qt::MoveAction | Qt::LinkAction;
} else {
return;
}
QPlatformDropQtResponse response = QWindowSystemInterface::handleDrop(m_dragWindow, dragData, m_dragPoint, supportedActions);
if (drag) {
static_cast<QWaylandDrag *>(QGuiApplicationPrivate::platformIntegration()->drag())->finishDrag(response);
}
}