Results 1 to 8 of 8

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

Threaded View

Previous Post Previous Post   Next Post Next Post
  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 08:36.

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.