Navigation

    Qt Forum

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

    • UNSOLVED Qt Quick 3D use 3D models with skeleton
      QML and Qt Quick • model qt quick 3d skeleton • • Dmitry87  

      1
      0
      Votes
      1
      Posts
      32
      Views

      No one has replied

    • UNSOLVED QtQuick3D access Model skeleton
      General and Desktop • model qtquick3d skeleton • • Dmitry87  

      1
      0
      Votes
      1
      Posts
      16
      Views

      No one has replied

    • UNSOLVED Views - what are the correct rules to use models?
      QML and Qt Quick • model delegate design view choose • • jeanmilost  

      2
      0
      Votes
      2
      Posts
      51
      Views

      @jeanmilost I can't answer all your questions, as I'm not an expert on Qt's Model/View system, what I do know is, that all models have a QAbstractItemModel as base model and that is also the ABI for all views. For that reason alone, you can assign all models to all views. You will however not get a useful representation of all your data in all views. As I understand it, and anyone fell me to correct me here, the other higher level classes of models are only there to make your life easier, as in you do not have to implement all functions/functionalities of the whole AbstractItemModel class
    • UNSOLVED Unable to edit QSqlTableModel from QML
      QML and Qt Quick • sqlite model model-view qsqltablemodel • • daljit97  

      4
      0
      Votes
      4
      Posts
      58
      Views

      @daljit97 said in Unable to edit QSqlTableModel from QML: , Qt::EditRole); Then you should probably pass the role and not editRole, otherwise model won't know which column to update.
    • SOLVED Saving memory by freeing off-screen QListView items?
      General and Desktop • listview sql model qlistview qsqltablemodel • • tague  

      10
      0
      Votes
      10
      Posts
      151
      Views

      @Christian-Ehrlicher It caches entries that could have fairly high resolution images in them. 100MB consumed is quite reasonable for my particular use case. I've solved my problem my creating a general-purpose list model class which does not retain too many recent items in memory, and then implementing an application-specific subclass that will automatically produce small, low-resolution thumbnails and save them to a separate table to allow for faster loading later on.
    • UNSOLVED Benefit of the model index
      General and Desktop • model index • • mix359  

      4
      0
      Votes
      4
      Posts
      142
      Views

      On the model you are free to expose the internal structure. QStandardItemModel does it by exposing QStandardItem for example. However if you don't want to make use of the QAbstractItemModel interface and its seamless integration with views and delegate and just use your custom classes why bother subclassing a model in the first place? Just start from scratch. I'm not suggesting this is the most efficient way in terms of developer time but if performance is the only priority then feel free to go as low level as you can
    • UNSOLVED Table proxy model for list view
      General and Desktop • model view proxy • • Patrick Wright  

      6
      0
      Votes
      6
      Posts
      1110
      Views

      After thinking about this problem more and looking at the interface for QAbstractProxyModel, I am beginning to think that a subclass of a proxy model is not the answer. I am wondering if the best course of action would be to create a new model which keeps a pointer to my base model. Every time the various data changed signals are emitted from the base model, my "proxy" model determines if a new sequence has been found. It then keeps track of all the various sequences in its own internal data structure which keeps QPersistenModelIndex indexes into the base model. Then my "proxy's" data() method would use these indexes to get the real data from the underlying model but parsed into the correct format. Do this sound like a better approach? In this case, I am also wondering how to display my data as a table where each row could have a different number of columns. Perhaps I could keep track of the row with the maximum number of columns and return this in columnCount()? Then my data() method would just return QVariant() for columns that don't exist in a given row.
    • UNSOLVED Is it possible through qml javascript change the value of an delegate of a TableViewColumn?
      QML and Qt Quick • qml tableview model tableviewcolumn • • Nmaster88  

      1
      0
      Votes
      1
      Posts
      117
      Views

      No one has replied

    • UNSOLVED create listView with certain items from array
      General and Desktop • listview model array modeldata • • Ldweller  

      1
      0
      Votes
      1
      Posts
      227
      Views

      No one has replied

    • UNSOLVED Proper way of resizing model in QTableView
      General and Desktop • qtableview model mvc • • JoseTomasTocino  

      5
      0
      Votes
      5
      Posts
      727
      Views

      @VRonin That's really useful, thank you very much. Also I didn't know about the "Model test", that's nice too.
    • UNSOLVED Tree View with varying column counts
      General and Desktop • qtreeview model model-view treemodel • • DaveK 0  

      1
      0
      Votes
      1
      Posts
      348
      Views

      No one has replied

    • SOLVED Model/View Tutorial role question
      General and Desktop • model view tutorial • • mmikeinsantarosa  

      8
      0
      Votes
      8
      Posts
      1092
      Views

      So it's built into the Qt base library then. I noticed also that any time the table gets clicked that method must get called again because I get another complete set of qDebug() messages. So paint() makes sense then as to why that happens. Thanks
    • UNSOLVED How do you persist and update your models?
      QML and Qt Quick • database model • • tskardal  

      4
      0
      Votes
      4
      Posts
      961
      Views

      @tskardal said in How do you persist and update your models?: I'm thinking that the goal is having "plain" models that are not QObjects. That's a quite normal thing to do. Let the Qt model be just an intermediary between actual data model/tree and the GUI. If your implementation works, then it's OK I guess. I'm not sure if there any actual question to answer here :-)
    • using pixmaps as an alternative to openPersistentEditor() in an itemView
      General and Desktop • model delegate view editor • • mortbopet  

      2
      0
      Votes
      2
      Posts
      660
      Views

      I'm doing something similar in sort of objects property tree. It works pretty well for large number of items. Definitely a massive win over a widget per item approach. One difference to your approach is that I don't use grab(), but instead have the editors created by the delegate a static drawing function that uses QStyle::drawControl and friends to draw an image of itself. This is because I don't want to instantiate all the editor widgets upfront to grab them (I have a bunch of them and it takes time). It's sort of a trade-off because it can get out of sync with the actual widget look. Whether this is something you'd be interested in or not is up to you, but the general idea of drawing an image is a valid one.
    • UNSOLVED Unable to assign GenericDataModel to GenericDataModel
      QML and Qt Quick • qml c++ model modelview view • • LScott  

      3
      0
      Votes
      3
      Posts
      836
      Views

      Interestingly, if I make the plugin static, it works fine. Only when the plugin is dynamic does this error happen... Very strange.
    • UNSOLVED How to use model to update Chart data
      QML and Qt Quick • qml widget model chart tableview table • • SaranshVora  

      1
      0
      Votes
      1
      Posts
      651
      Views

      No one has replied

    • UNSOLVED Can someone provide a working example of VXYModelMapper with lineseries chart ?
      QML and Qt Quick • qml model qtcharts cpp qtchart • • SaranshVora  

      7
      1
      Votes
      7
      Posts
      2416
      Views

      @rahulch_pp Try to comment the line 18 of main.qml " animationOptions: ChartView.AllAnimations". It seems to be buggy from Qt5.12 (and also Qt5.12.1)
    • UNSOLVED QAbstractItemModel::Index(...) and Internal pointers when Data in persistant memory not in RAM
      General and Desktop • sql model sqlite3 view • • Kofr  

      16
      0
      Votes
      16
      Posts
      5049
      Views

      Hi! Just to be sure I understood this correctly: You have a single DB with a humongous number of identically structured tables? Do you really believe you can store 2^128 bits / rows / tables / whatever in your database / filesystem / datacenter? In worst case I will have to keep in RAM about 4e+38 of 16 bytes pointers Even that is way more rows than what a SQLite table can hold (see: https://www.sqlite.org/limits.html).
    • SOLVED QCombobox with key and value
      QML and Qt Quick • qml qt quick model qcombobox key and value • • tamlong0205  

      4
      0
      Votes
      4
      Posts
      1486
      Views

      I had create a model with key and value and pass it to qml, it worked!!! Sorry for late reply. Thank you @raven-worx
    • UNSOLVED Simple Tree Model derived from QAbstractItemModel inserting new Nodes?
      General and Desktop • model qabstractitemmo tree treemodel • • Opa114  

      1
      0
      Votes
      1
      Posts
      443
      Views

      No one has replied

    • UNSOLVED How to assign the Qlist as model for ListView?
      General and Desktop • listview model qlist • • Mathan M  

      3
      0
      Votes
      3
      Posts
      1630
      Views

      The easy way: get rid of PortalMapItemInfo, store the values in 4 different QStringList and use a QStringListModel The proper way: in HomeController.h add Q_DECLARE_METATYPE(PortalMapItemInfo) http://doc.qt.io/qt-5/qmetatype.html#Q_DECLARE_METATYPE Instead of a List store your data in a 1-column QStandardItemModel and expose it via a Q_PRPERTY
    • UNSOLVED How to bind the listview using listelement with dynamic values?
      General and Desktop • listview model listmod • • Mathan M  

      2
      0
      Votes
      2
      Posts
      652
      Views

      @Mathan-M Why do you want to bind to ListElement? ListElement's are added to ListModel. You should probably try to access this model from C++. ListModel is also a QAbstractItemModel.
    • UNSOLVED Smarter way to get a list of children in Tree Model
      General and Desktop • model proxy • • VRonin  

      5
      1
      Votes
      5
      Posts
      2925
      Views

      @VRonin said in Smarter way to get a list of children in Tree Model: the overridden data is to store somewhere the level in the original tree before it gets flattened by KDescendantsProxyModel. I don't believe you need that. Pushing a tree model to a list/table view should give you list/table with the root-level items (speculation again!). In my mind it should be just enough to "move" the root of the model before giving it to the view. I didn't feel like going through building a QAbstractProxyModel from scratch Well, yes, I can see why, but if you think about it, most of your methods should turn out trivial (more or less) - similarly to the identity proxy model. Kind regards.
    • UNSOLVED selection update on model sorting/re-ordering with Qt
      General and Desktop • model selection mvc proxy sort • • JulienLopez  

      3
      0
      Votes
      3
      Posts
      1010
      Views

      Yeah but the user also want to be able to reorder things as he wants, not just sort (ie, put this row here, drag all my selection at this position, invert these two rows, ...)
    • UNSOLVED Item on Repeater create and destroy when model changed
      QML and Qt Quick • model repeater • • helenebro  

      5
      0
      Votes
      5
      Posts
      1940
      Views

      Ok. Thank you for your answer. I never use QAbstractListModel. Do you have some keys to start ? What is difference between using QAbstractListModel and QQmlListProperty ? In which case is it better to use them ?
    • UNSOLVED How to pass a function as model data?
      QML and Qt Quick • qml model function modeldata role • • jdcordoba  

      4
      0
      Votes
      4
      Posts
      1273
      Views

      That's a brilliant and elegant solution! Thank you bro for spending your precious time with a newbie like me!
    • UNSOLVED Accessing item delegate by model index or why Quick sucks when working with models?
      QML and Qt Quick • model quick mvc treev • • Kofr  

      11
      0
      Votes
      11
      Posts
      4745
      Views

      @p3c0 said: @Kofr So is it that you want to access the roles (namely hue, saturation, brightness) values from outside of this ListView delegate ? If so then did you accessing ListVIew model from outside ? Once you get hold of it the data can be accessed too. code above is just example, not my case. what I need is to get model.roleName of delegate j when I work in delegate i
    • UNSOLVED Model views with pagination
      QML and Qt Quick • model delegate grid page navigation • • Mark81  

      8
      0
      Votes
      8
      Posts
      4308
      Views

      @Mark81 Even in JavaScript you have two models, you just don't typically think of it that way: model 1: the database, model 2: the results on the client side. Here, you have two models: 1 - the database, 2 - the QML side. So what you need to do is create a paginated model using LIMIT/OFFSET queries.
    • UNSOLVED QML: ListView highlightFollowsCurrentItem and shortest path
      General and Desktop • listview model delegate highlight • • Mark81  

      4
      0
      Votes
      4
      Posts
      1596
      Views

      @Mark81 If index is 0 then don't start the animation. Well something like: property int myIndex : 0 function animate(idx) { listAnimation.running = false var pos = list.contentY; var destPos; list.positionViewAtIndex(idx, ListView.Beginning); destPos = list.contentY; listAnimation.from = pos; listAnimation.to = destPos; listAnimation.running = true; } Timer { ... onTriggered: { if(myIndex==0) list.positionViewAtIndex(myIndex,ListView.Beginning); else animate(myIndex) myIndex++ if(myIndex==list.count-1) myIndex = 0 } }
    • UNSOLVED QML ListView inside Repeater
      QML and Qt Quick • qml c++ listview model repeater • • Qmyo  

      2
      0
      Votes
      2
      Posts
      1622
      Views

      @Qmyo You can create a 2 Q_INVOKABLE functions. One will return the Repeater's model number and other will return ListView's models. You can make use of index attached property which can be passed to the Q_INVOKABLE functions to return particular model.
    • SOLVED How to update QTableView when rows are inserted to it
      General and Desktop • model • • Ratzz  

      23
      0
      Votes
      23
      Posts
      11274
      Views

      In dropEvent called a new function from model which stores all the parameter of item when droped and emitted layoutAboutToBeChanged() before appending to my TableList and then emitted layoutChanged() which worked for me. Thanks to @kshegunov , @SGaist , @mrjj for the help.
    • SOLVED QStandardItemModel appendRow doesn't update QML TreeView
      General and Desktop • qt quick model treeview • • BitteWenden  

      24
      0
      Votes
      24
      Posts
      6997
      Views

      Sneaky one ! Glad you found out :)
    • UNSOLVED Use FileSystemModel with custom data
      QML and Qt Quick • qtquick model filesystem • • BitteWenden  

      1
      0
      Votes
      1
      Posts
      446
      Views

      No one has replied

    • UNSOLVED SqlModels: QSqlTableModel's that are created entirely from QML
      Showcase • qml sql model thread qsqltablemodel • • Leei  

      13
      0
      Votes
      13
      Posts
      3870
      Views

      @SGaist I don't mind refactoring it, it's not very long. I will definitely look into this. Thanks!
    • UNSOLVED bind to model data on other role from item delegate
      QML and Qt Quick • tableview model • • Alexander_Lanin  

      1
      0
      Votes
      1
      Posts
      450
      Views

      No one has replied

    • SOLVED Qt 5.6 MapItemView issue
      QML and Qt Quick • qt5.6 model delegate mapitemview • • ginkgoguy  

      3
      0
      Votes
      3
      Posts
      1247
      Views

      Thanks for your efforts. As you said it works in a project I have a second look at my code. I'm not writing a Quick-App but a QWidget-App and use the map inside a QQuickWidget. I have read about another approach to embed qml content in a QWidget-App using QQuickView inside a QObject-Container. This approach works as expected. I don't know why it doesn't work with a QQuickWidget but my problem is solved. Best Regards