Skip to content
  • 138k Topics
    701k Posts
    L

    I use it for a 2 level TreeModel. The second level has another data type, so I have another set of methods like addSubItem(ItemData *data, SubItemData *subdata) and removeSubItem(ItemData *data, SubItemData *subdata). These methods query for the TreeItem which contains data and add a TreeItem child with subdata. But for testing purposes, I removed the code for the second level, thus am currently only working with the first level to solve this problem.

    @Christian-Ehrlicher said in QTreeView crashes due to deleted row:

    Then please remove layoutChanged() - this is not needed at all.

    If I remove that, the QTreeView does not show the added item.

    @Christian-Ehrlicher said in QTreeView crashes due to deleted row:

    Also you don't check if getItem() returns a valid pointer.

    getItem() looks like this (removed the Custom for simplicity):

    TreeItem *TreeModel::getItem(const QModelIndex &index) const { if (index.isValid()) { TreeItem *item = static_cast<TreeItem*>( index.internalPointer() ); if (item) { return item; } } return _rootItem; }

    So, it should always return a valid pointer, or am I missing something here?

    @Christian-Ehrlicher said in QTreeView crashes due to deleted row:

    provide a minimal, compilable example of the model. We e.g. don't know what's happening inside _rootItem->removeChild().

    The implementations for the TreeItem look like this (_childItems is a QList<TreeItem*>):

    void TreeItem::appendChild(TreeItem *item) { item->_parentItem = this; _childItems.append( item ); } void TreeItem::removeChild(TreeItem *item) { _childItems.removeOne( item ); } int TreeItem::row() const { if( _parentItem != nullptr ) { return _parentItem->_childItems.indexOf( const_cast<TreeItem*>( this ) ); } return 0; }

    The TreeModel is mainly implemented accoring to the example EditableTreeModel. Please let me know, if you need more clarification about the model.

    The last portion of the stack trace looks like this:

    1 TreeItem::row treeitem.cpp 157 0x7ff7a780c808
    2 TreeModel::parent treemodel.cpp 265 0x7ff7a780d8a2
    3 QModelIndex::parent qabstractitemmodel.h 481 0x7ffe8a33a63a
    4 QTreeView::isIndexHidden qtreeview.cpp 3073 0x7ffe8a33a63a
    5 QTreeView::isIndexHidden qtreeview.cpp 3071 0x7ffe8a33a63a
    6 QTreeViewPrivate::visualRect qtreeview.cpp 1098 0x7ffe8a33b837
    7 QTreeView::visualRect qtreeview.cpp 1073 0x7ffe8a33ba08
    8 QAbstractItemView::inputMethodQuery qabstractitemview.cpp 906 0x7ffe8a2de7a0

    This is because I override the dragMoveEvent(QDragMoveEvent *event), dropEvent(QDropEvent *event) and paintEvent(QPaintEvent *event) in my subclassed QTreeView.

  • Jobs, project showcases, announcements - anything that isn't directly development
    4k Topics
    22k Posts
    T

    Have you solved this problem yet? I'm having the same problem trying QT6!

  • Everything related to designing and design tools

    95 Topics
    300 Posts
    T

    True TableView and TreeView tooling is missing - create a report that you expect it at https://bugreports.qt.io/

  • Everything related to the QA Tools

    45 Topics
    130 Posts
    K

    I've seen WPF and others listed, but I haven't seen anything that mentions WinUI 3 support for Squish.

  • Everything related to learning Qt.

    363 Topics
    2k Posts
    P

    Thanks @Emilia_Qt ! If it's planned to happen this year then in it's all fine.

  • 2k Topics
    12k Posts
    Axel SpoerlA

    I have a verified / valid QList of actions.

    No, you haven't.
    The given List holds QObjectpointers, not actions. It's a QObjectList.
    Most of the content items are QAction pointers, but not all of them. Its consistency as a list of actions has neither been properly verified, nor validated.

    I am not entirely sure, what you mean by "execute". An action can't be executed, it has no exec()slot.
    It can be triggered, by calling QAction::trigger(), in which case it emits it's triggered()signal. If a slot is connected to that signal, the slot will be called.

    This is how to obtain a list of QActionchildren, and trigger all of them:

    const auto actionList = pTEST->findChildren<QAction *>(); for (auto *action : actionList) action->trigger();
  • 4k Topics
    17k Posts
    M

    Buongiorno a tutti.
    Inizialmente mi scuso se sono poco preciso o sbaglio qualcosa...
    Due anni fa avevo iniziato ad usare Qt, windows, per realizzare un semplice programma desktop. Poi il progetto s'è arenato ed ora che ho un po' di tempo libero volevo tornare a giocarci un po'.
    Ma mentre ai tempi usavo la versione 5, non riesco a trovare una versione 6 da scaricare per un uso puramente dilettantesco (sul mio PC di casa per intenderci).
    Ho provato ma installando qualcosa mi chede un account... E non so come fare.
    Navigando ho trovato questo link
    https://www.qt.io/offline-installers
    Ho scelto (per vari motivi) di scaricare lo zip da 1.39 GB, la versione 6.7.
    E' il passaggio corretto? Perchè prima quando continuavo mi chiedeva una email commerciale, mandava un codice e l'utilizzo era limitato a 30 gg.

    Grazie in anticipo e scusate ancora se ho chiesto qualcosa di ripetitivo/inutile.

  • This is where all the posts related to the Qt web services go. Including severe sillyness.
    1k Topics
    10k Posts
    F

    Hm, that's an idea. Maybe rename it to "Qt Next", "Future Qt", something like that?