Results 1 to 7 of 7

Thread: QDrag ignore cursor icon

  1. #1
    Join Date
    May 2013
    Posts
    321
    Thanks
    9
    Thanked 8 Times in 8 Posts
    Qt products
    Qt5
    Platforms
    MacOS X Unix/X11 Windows

    Default QDrag ignore cursor icon

    Hi all,
    I would have the forbidden cursor if the drop is not possible, here what I do in dragEnter :
    Qt Code:
    1. if( m_DragActorArray.Empty() )
    2. {
    3. event->ignore();
    4. return;
    5. }
    To copy to clipboard, switch view to plain text mode 
    But I don't see the forbidden cursor, why ?
    Thanks for the help

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: QDrag ignore cursor icon

    Maybe the parent widget accepts the drag? Hard to say without a compilable example reproducing the problem.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  3. #3
    Join Date
    May 2013
    Posts
    321
    Thanks
    9
    Thanked 8 Times in 8 Posts
    Qt products
    Qt5
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: QDrag ignore cursor icon

    Yes the parent widget accept the drag because inside it can drop but on the target where I ignore it should not.

  4. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: QDrag ignore cursor icon

    Try modifying the event object to mark no drop actions are accepted.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  5. #5
    Join Date
    May 2013
    Posts
    321
    Thanks
    9
    Thanked 8 Times in 8 Posts
    Qt products
    Qt5
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: QDrag ignore cursor icon

    No effects :
    Qt Code:
    1. if( m_DragActorArray.Empty() )
    2. {
    3. event->ignore();
    4. event->setDropAction( Qt::IgnoreAction );
    5. return;
    6. }
    To copy to clipboard, switch view to plain text mode 
    The code from the QListView where the drag start :
    Qt Code:
    1. virtual void startDrag( Qt::DropActions supportedActions )
    2. {
    3. QDrag* Drag = new QDrag( this );
    4. Drag->setMimeData( model()->mimeData( selectedIndexes() ) );
    5. Drag->exec( supportedActions );
    6. }
    To copy to clipboard, switch view to plain text mode 
    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 :
    Qt Code:
    1. connect( &m_Timer, SIGNAL( timeout() ), this, SLOT( UpdateOneFrame() ) );
    To copy to clipboard, switch view to plain text mode 
    Qt Code:
    1. void IRenderWidget::UpdateOneFrame()
    2. {
    3. if( m_Initialized )
    4. {
    5. DE::CEngine::GetRenderer().SetRenderWindow( m_RenderWindow );
    6. OnUpdate();
    7. DE::CEngine::GetRenderer().EndOfRendering();
    8. m_RenderWindow->EndFrame();
    9. m_RenderWindow->StartFrame();
    10. }
    11. }
    To copy to clipboard, switch view to plain text mode 
    Last edited by Alundra; 17th January 2015 at 03:23.

  6. #6
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: QDrag ignore cursor icon

    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?
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  7. #7
    Join Date
    May 2013
    Posts
    321
    Thanks
    9
    Thanked 8 Times in 8 Posts
    Qt products
    Qt5
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: QDrag ignore cursor icon

    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.

Similar Threads

  1. QDrag black cursor
    By Alundra in forum Qt Programming
    Replies: 0
    Last Post: 7th November 2014, 02:33
  2. How to remove QDrag ignore icon
    By mstegehu in forum Qt Programming
    Replies: 0
    Last Post: 31st July 2012, 09:12
  3. change cursor icon while program is busy
    By Tomasz in forum Newbie
    Replies: 19
    Last Post: 24th September 2010, 12:24
  4. QPushButton icon & dialog cursor
    By hulud in forum Qt for Embedded and Mobile
    Replies: 1
    Last Post: 5th November 2009, 15:08
  5. Replies: 2
    Last Post: 12th October 2008, 14:42

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.