Results 1 to 8 of 8

Thread: QAbstractItemModel and drags&drops problem [or maybe I am the problem?]

  1. #1
    Join Date
    Jun 2007
    Posts
    8
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default QAbstractItemModel and drags&drops problem [or maybe I am the problem?]

    Hi,

    This is a mail I sent to QT-support :

    I have a little problem with QTreeView management of drag&drops :
    To illustrate this, I join to this mail the QT-SimpleTreeModel example modified to show that :

    Writing in my QAbstractItemModel::flags() :
    -------------
    if (!index.isValid())
    return Qt::ItemIsEnabled;

    if (! index.parent().isValid())
    return Qt::ItemIsEnabled | Qt::ItemIsSelectable | Qt::ItemIsDragEnabled ;

    return Qt::ItemIsEnabled | Qt::ItemIsSelectable | Qt::ItemIsEditable | Qt::ItemIsDragEnabled | Qt::ItemIsDropEnabled;
    ---------------
    I expected to enable the drops only on non-toplevel items.
    But what I got is : enable drops only on CHILDREN of non-toplevel items.
    In the example, we can traduce that by :
    I can start draging for instance the item "Getting started" but I can't drop it onto "Designing a component/creating a dialog".
    However, I can drop it on "Form Editing Mode / Layouts / The grid layout"

    I hope I am understandable, please forgive my bad english I'm a french guy :-(

    I don't know if it is a bug ? If it is a wanted feature, could you indicate me how can I have the result I expected ?
    The support engineer told me that he managed to perform a drop onto for instance "Designing a component/creating a dialog" , that is forbidden (but I expected that would be allowed) when I execute the example program on my computer (UNIX kubuntu gutsy, QT 4.3.0).
    Could you tell me if on other platforms all works perfectly or I someone can reproduce my bug ? or tell me what's wrong in my code or my vision of flags and drags&drops ?
    Thanks
    Romain
    Attached Files Attached Files
    Last edited by roro; 22nd June 2007 at 09:36.

  2. #2
    Join Date
    Jan 2006
    Location
    Paris, France
    Posts
    227
    Thanks
    3
    Thanked 21 Times in 21 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: QAbstractItemModel and drags&drops problem [or maybe I am the problem?]

    Hey, maybe I can help you directly via MSN, I'm French too ;-)

  3. #3
    Join Date
    Jun 2007
    Posts
    8
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: QAbstractItemModel and drags&drops problem [or maybe I am the problem?]

    Hello,

    I do not have MSN at work, but if you want to help me trough this forum, it's ok
    What does my program do with you ?

  4. #4
    Join Date
    Jan 2006
    Location
    Paris, France
    Posts
    227
    Thanks
    3
    Thanked 21 Times in 21 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: QAbstractItemModel and drags&drops problem [or maybe I am the problem?]

    Ok ok, I'll check this out tomorrow then (sorry, I forgot about this thread )

  5. #5
    Join Date
    Jun 2007
    Posts
    8
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: QAbstractItemModel and drags&drops problem [or maybe I am the problem?]

    Up, could someone help me please ? It's just compiling my program and trying a drag and drop...

  6. #6
    Join Date
    Jan 2006
    Location
    Paris, France
    Posts
    227
    Thanks
    3
    Thanked 21 Times in 21 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: QAbstractItemModel and drags&drops problem [or maybe I am the problem?]

    I'm currently compiling ;-)

  7. #7
    Join Date
    Jan 2006
    Location
    Paris, France
    Posts
    227
    Thanks
    3
    Thanked 21 Times in 21 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: QAbstractItemModel and drags&drops problem [or maybe I am the problem?]

    Okay, test done !

    Well, it's forbidden to drop the item on top-level items, but I can drop it on child items...
    I mean the cursor is not a forbidden sign...

    But I can't drop it anyway, it seems I'm allowed to drop it on child items, but it's not effective.

    Hope this helps.

  8. #8
    Join Date
    Jun 2007
    Posts
    8
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: QAbstractItemModel and drags&drops problem [or maybe I am the problem?]

    Thanks guilugi

    But I don't understand why I am the only one having a forbidding icon when I try a drop on children of toplevels items

    Anyway, I resolved my problem making tests in my dropMimeData() method. Not very beautiful, but...

    Thanks for your help

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.