PDA

View Full Version : QDrag ignore cursor icon



Alundra
16th January 2015, 02:17
Hi all,
I would have the forbidden cursor if the drop is not possible, here what I do in dragEnter :


if( m_DragActorArray.Empty() )
{
event->ignore();
return;
}

But I don't see the forbidden cursor, why ?
Thanks for the help

wysota
16th January 2015, 08:55
Maybe the parent widget accepts the drag? Hard to say without a compilable example reproducing the problem.

Alundra
16th January 2015, 12:37
Yes the parent widget accept the drag because inside it can drop but on the target where I ignore it should not.

wysota
16th January 2015, 12:59
Try modifying the event object to mark no drop actions are accepted.

Alundra
17th January 2015, 04:00
No effects :


if( m_DragActorArray.Empty() )
{
event->ignore();
event->setDropAction( Qt::IgnoreAction );
return;
}

The code from the QListView where the drag start :


virtual void startDrag( Qt::DropActions supportedActions )
{
QDrag* Drag = new QDrag( this );
Drag->setMimeData( model()->mimeData( selectedIndexes() ) );
Drag->exec( supportedActions );
}

The forbidden cursor is showed for all other widget but once it enters the widget this topic is about, the cursor never shows forbidden forever.
The widget uses a QTimer to update from a 3D Engine :

connect( &m_Timer, SIGNAL( timeout() ), this, SLOT( UpdateOneFrame() ) );


void IRenderWidget::UpdateOneFrame()
{
if( m_Initialized )
{
DE::CEngine::GetRenderer().SetRenderWindow( m_RenderWindow );
OnUpdate();
DE::CEngine::GetRenderer().EndOfRendering();
m_RenderWindow->EndFrame();
m_RenderWindow->StartFrame();
}
}

wysota
17th January 2015, 10:21
Ok, what exactly is the type of the widget you are trying to block drags for? Are you sure this is not a composed widget where you need to block drags on its viewport?

Alundra
17th January 2015, 16:52
The widget I try to block the drag is just a custom widget inherited from QWidget I use to send the 3D engine inside.
All works without crash, just the cursor doesn't shows "forbidden".
I block the drag if no object can be created from drag-and-drop.