Results 1 to 3 of 3

Thread: Nubie: QToolBar draggable item

  1. #1
    Join Date
    Jul 2009
    Posts
    22
    Qt products
    Qt4
    Platforms
    MacOS X Windows

    Unhappy Nubie: QToolBar draggable item

    Hello Everyone,

    My first post, yay.

    Quite new to Qt, managed to get a tree widget dragging and dropping into
    a graphics scene, works fine.

    Now I want to have a toolbar that I can drag and drop different shapes into
    my graphics scene.

    Been on this for days, and going mad.

    I tried with normal QToolBar but actions dont drag, tried with a widget but
    couldn't see anything think my widget was broken somewhere. Now I'm
    trying with QToolButton, but my tool button seems to be both in the toolbar
    and also invisible over the top of the toolbar.

    Is there any examples of dragging from a tool bar item?

    My next step might be to create another graphics scene/view that I can drag items
    from to go into my main graphics scene, i.e. make my own 'tool bar' but seems
    a bit of a pain.

    Help me please!

    DB

  2. #2
    Join Date
    Jul 2009
    Posts
    22
    Qt products
    Qt4
    Platforms
    MacOS X Windows

    Default Re: Nubie: QToolBar draggable item

    Half fixed it. Think I had some widgets which where getting in the way.

    So now I have a ToolButton with an overloaded mousePressEvent which
    starts a drag item. And this can be dropped in my graphics scene.

    However, it seems to drop two items. Or at least two items are created.

    Any thoughts?

    DB

  3. #3
    Join Date
    Jul 2009
    Posts
    22
    Qt products
    Qt4
    Platforms
    MacOS X Windows

    Default Re: Nubie: QToolBar draggable item

    All Fixed. Sorry.

    When setting up the MimeData I used "some string" rather than QString("Some string").
    This confused the read/create new nodes in the Graphics Scene.

    Works now. Now I just need to put in the program logic!

    Thanks

    DB

Similar Threads

  1. View, Scene, Item and thread??
    By dungsivn in forum Qt Programming
    Replies: 5
    Last Post: 20th August 2008, 19:21
  2. Item Delegate Painting
    By stevey in forum Qt Programming
    Replies: 3
    Last Post: 9th May 2008, 07:37

Tags for this Thread

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
  •  
Qt is a trademark of The Qt Company.