Navigation

    Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Search
    1. Home
    2. Tags
    3. qmodelindex
    Log in to post

    • UNSOLVED segv when getting QFileInfo from subclassed QFileSystemModel
      General and Desktop • qtableview qabstractitemmo qfilesystemmode qmodelindex qt5.13.1 • • CybeX  

      2
      0
      Votes
      2
      Posts
      44
      Views

      What's the benefit of FileSystemModel::getFileInfo()? I would guess your this pointer is a nullptr
    • UNSOLVED Is it possible to notify items in the model without signals?
      General and Desktop • signal & slot qmodelindex abstractlist • • arguskso  

      6
      0
      Votes
      6
      Posts
      69
      Views

      @arguskso said in Is it possible to notify items in the model without signals?: when new data is coming I can emmit signal with an id and all delegates will receive it and one with the corresponding id will send one more signal back to the model with it's index in the model. Delegates are used for displaying, they don't know anything about the internal data structure and don't have really access to anything else except it's own index. This can't work. You have to do it the way @JonB suggested to you.
    • UNSOLVED QSortFilterProxyModel not mapping properly
      General and Desktop • qmodelindex itemmodel qsorfilterproxy • • zmurphy  

      8
      0
      Votes
      8
      Posts
      635
      Views

      You can check you model implementation with the QAbstractItemModelTester. See this wiki entry.
    • SOLVED Subclassing QModelIndex - private constructor?
      General and Desktop • qmodelindex • • Dariusz  

      20
      0
      Votes
      20
      Posts
      882
      Views

      Hmmmmmmmm Ok. Time to rethink my live decisions :- ) Thanks so much for info & putting up with my whining. Thanks every one! :- ) Regards Dariusz
    • UNSOLVED Multithreading conversion of QModelIndexList to treeItem crash
      General and Desktop • qtreeview qmodelindex qmodelindexlist • • Dariusz  

      4
      0
      Votes
      4
      Posts
      675
      Views

      @Dariusz said in Multithreading conversion of QModelIdnexList to treeItem crash: Well I have 100k items +/- to deal with Then you should avoid to dereference the pointers to not copy the data around. I created the base vectors via QVector<myTreeNode> vec(vecSize) and I access them all via [], so no thread should step over another thread, It does as your backtrace shows. Since you're using QVector which is implicit shared every write access to the container checks if the container needs to get detached. Maybe try with a non-implicit shared container instead (e.g. a std::vector) See http://doc.qt.io/qt-5/implicit-sharing.html for details.
    • SOLVED how to updating a view's proxy model when the source model changes.
      General and Desktop • qsortfilterprox qstandarditemmo qmodelindex • • Yash001  

      10
      0
      Votes
      10
      Posts
      3449
      Views

      @VRonin Thank you. Yesterday, I tried same things. But it was not working than later on I found, I forget to add file name in SOURCE , HEADER. Now it is work as expectation.
    • UNSOLVED QAbstractItemModel item identification from ModelIndex
      General and Desktop • qtreeview qmodelindex • • poty  

      4
      0
      Votes
      4
      Posts
      837
      Views

      Then you have to propagate the information when your underlying data changes.
    • SOLVED Extract data from QModelIndex
      General and Desktop • qmodelindex qmodelindexlist • • UnitScan  

      3
      0
      Votes
      3
      Posts
      895
      Views

      @mrjj yes, thank you!
    • UNSOLVED QAbstractItemModel: how can I associate more data with a QModelIndex than just a pointer or integer?
      General and Desktop • qabstractitemmo qmodelindex internalpointer • • Guy Gizmo  

      21
      0
      Votes
      21
      Posts
      5506
      Views

      @Guy-Gizmo said: The whole point of me setting it up that way is that the actual logical structure of the data and the physical arrangement and implementation of it are conceptually completely separate. The latter is abstracted away by the interface of the former. Then I think the cleanest solution is to have a tree (or w/e) that represents your logical structure, and that will abstract the whole physical layer. For a simple example you can look at the docs - the simple tree model. You can put anything in that tree and it's basically your "data interface". It also shouldn't care that the physical nodes are destroyed as long as there's a logical node living. This way you don't have with model indexes and things getting destroyed in the background, because it's the middleman's responsibility. You should hover take care to notify the model when a node/leaf from the "logical structure" tree is destroyed (through the appropriate signals), so views can make proper adjustments. I hope that helps somewhat. Kind regards.
    • SOLVED QStandardItemModel not inserting children
      General and Desktop • qstandarditemmo qmodelindex • • Trilec  

      8
      0
      Votes
      8
      Posts
      2422
      Views

      Thanks SGaist, will tag as solved.
    • SOLVED QAbstractItemModel with QTreeview and accessing through indexing
      General and Desktop • qtreeview qabstractitemmo qmodelindex • • Trilec  

      9
      0
      Votes
      9
      Posts
      7771
      Views

      Cool, Thanks for all the insite: I have solved the problem with a little more testing. For the sake of completeness and for others Ive included my code: void DialogStructureXML::on_btn_add_toroot_released() { QModelIndex currentIndex = ui->tree->selectionModel()->currentIndex(); QModelIndex rootIndex = ui->tree->rootIndex(); QModelIndex traceIndex = currentIndex; QModelIndex child = currentIndex; tree_model *model = (tree_model*) ui->tree->model(); int rowCount = model->rowCount(); int currentRow = 0; int prevRow = 0; //some string cleanup QString ItemText = ui->edit_textvaluefortree->text() ; ItemText.simplified(); //If its a valid index (ie: valid something in the GUI tree) trace back to the parent if ( traceIndex.isValid() ) { while ( traceIndex.isValid() ) { currentRow = traceIndex.row()+1; traceIndex = model->parent(traceIndex); } } if (!model->insertRow(currentRow, rootIndex)) return; child = model->index(currentRow, 0, rootIndex); //Column index 0 model->setData(child, QVariant( ItemText ), Qt::EditRole); return; }
    • SOLVED QModelIndex is invalid in QTreeView based on Qt SimpleTreeModel example (source code pasted)
      General and Desktop • qtreeview qmodelindex internalpointer qmodeindex qtre simpletreemodel • • qt_fan_4k  

      3
      0
      Votes
      3
      Posts
      1489
      Views

      The dummy child is the culprit. It did not set the parent so the parent is invalid.
    • SOLVED Reading a value from tableView
      General and Desktop • tableview qmodelindex index • • gabor53  

      3
      0
      Votes
      3
      Posts
      2824
      Views

      Thank you. It worked!
    • Highlight text given a search string
      General and Desktop • qtableview qstyleditemdele qtextdocument modelview qmodelindex qmodelindexlist qstyleoption qtdisplayrole qabstractdocume • • frostbytes89  

      2
      0
      Votes
      2
      Posts
      996
      Views

      Hi and welcome to devnet, What about painting a partially transparent rectangle over the part of the text that should be highlighted ? You could draw the text first and then the rectangle over. Hope it helps
    • SOLVED Programmatically change the background color of a QModelIndex role
      General and Desktop • qmodelindex • • phamtv  

      7
      0
      Votes
      7
      Posts
      6195
      Views

      @StephanB hi and welcome The thread is 4 years old so the persons are most likely never to see it. The rest of the code belong to a custom/subclass model. So what call the code, it the framework / the view that use this model. You can read about it here: http://doc.qt.io/qt-5/model-view-programming.html https://www.youtube.com/watch?v=ytKDsJgJa4k http://www.informit.com/articles/article.aspx?p=1405547&seqNum=3