Skip to content
  • 0 Votes
    6 Posts
    1k Views
    D

    I've wrote 1 treeView/model system last year that had it all re-implemented from scratch, a few days ago I decided to rewrite it to increase performance and relay more on native functions of QT. Which I did and works great but the margin thing is a sticking point. I remember how much work it was before to get it to work properly... took a while as I had to write quite a few functions before I got to the point of margin detection. I'm very surprised there is no

    margin = (qt code ) + userMarginOverrideVal

    in the canDrop() function... this would have allowed us to just say, hey add +5 pixels to detection or something like that...

    Perhaps I should add it to feature request, would posting it in a bug report tracker be a good place? I don't see feature requests and I have no idea how to get the source to compile (Just didn't spend enough time on it) and add it myself & post to qt as commit...

    As far as I can tell we need like 2 functions, setOverrideMargin(int val) and getOverrideMargin(), skipping setting flag true/false if we want to use it as defaultVal should just be 0...

    TIA

  • 0 Votes
    3 Posts
    696 Views
    D

    @raven-worx said in QTreeView/Model drop action - no expand sign ?:

    Also did you emit the dataChanged() signal on the parent index?

    I've just read the post. I forgot to correct it. This is what I edit:

    bool testModel::dropMimeData(const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent) { ... Q_EMIT dataChanged(itemFirst.index(),itemLast.index()) }

    Hmmmm so I tried this, the parent is the object that is in function above.

    Q_EMIT dataChanged(parent, parent)

    Now this now "magically" works, I get extra ">" when I drop item on another item...
    I also learned that I also need to call Q_EMIT layoutChanged({parent}/flag) to update view if I drop items on expanded parent...

    Ok all good then, thanks! Weird issue o.o