Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved
    1. Home
    2. Tags
    3. model
    Log in to post
    • All categories
    • mzimmers

      Solved QVariant to QList
      General and Desktop • c++ model • • mzimmers

      13
      0
      Votes
      13
      Posts
      137
      Views

      mzimmers

      @JoeCFD said in QVariant to QList:

      Understand. Thiink about you can never be number 1 anymore if you play chess.

      Oddly enough, that was never a concern of mine.

    • P

      Solved QTableWidget Model (CellWidget) And LimeReport problem
      General and Desktop • qtablewidget limereport model • • Proton Phoenix

      5
      0
      Votes
      5
      Posts
      87
      Views

      P

      @SGaist
      That's What i want bro Really Thank you <3

    • BeaverShallBurn

      Solved Proper way to create a QTreeView + QTabWidget application
      General and Desktop • qtreeview qstandarditem mvc model modelview • • BeaverShallBurn

      7
      0
      Votes
      7
      Posts
      143
      Views

      BeaverShallBurn

      @JonB

      Huge thanks, you solved the puzzle for me!

    • G

      Solved Which class allows the analysis of files and folders present on the hard drive and their return in the form of a ready-to-use model?
      Qt 6 • c++ qt model mvc • • gouneken

      3
      0
      Votes
      3
      Posts
      203
      Views

      G

      @Gojir4 thank you so much

    • O

      Solved QComboBox keep currentText after model update
      General and Desktop • qcombobox model widgets • • Oshio

      2
      0
      Votes
      2
      Posts
      132
      Views

      O

      The problem arises from the usage of the method m_model.setStringList(). The latter always clear the previous data, hence the index always reset upon its call.

      Solution:

      Use m_model.setStringList() only in the constructor to init the model.

      After that manually insert the row on the model and set the data for the respective row. This can be achieved with a simple modification in the slot method.

      MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent) , ui(new Ui::MainWindow) { ui->setupUi(this); m_model.setStringList({"1","2"}); ui->comboBox->setModel(&model); } void MainWindow::on_pushButton_clicked() { m_model.insertRow(model.rowCount()); m_model.setData(model.index(model.rowCount()-1), "3"); }

      In the example above, "3" is appended to the list model without changing the current index from the QComboBox.

    • N

      Unsolved Gridview / Grid - How to implement the following with a model
      QML and Qt Quick • qml gridview grid model flickable • • Nagarjun

      5
      0
      Votes
      5
      Posts
      419
      Views

      N

      Hi @LeLev,

      I tried your solution. Its showing the image. That is fine.
      Now if i have more elements then its filling in the same space.
      I need to scroll thorough the screen to see the elements.
      How to do that ? How should I use Flickable in this case.

      Note: For example: If the screen layout is 500x500, and each element size id 50x50,
      then i should only see 16 elements initially. I have to scroll down on the screen to see the remaining elements.

    • Dmitry87

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

      1
      0
      Votes
      1
      Posts
      226
      Views

      No one has replied

    • Dmitry87

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

      1
      0
      Votes
      1
      Posts
      187
      Views

      No one has replied

    • jeanmilost

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

      2
      0
      Votes
      2
      Posts
      237
      Views

      J.Hilk

      @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

    • D

      Unsolved Unable to edit QSqlTableModel from QML
      QML and Qt Quick • qsqltablemodel sqlite model model-view • • daljit97

      4
      0
      Votes
      4
      Posts
      299
      Views

      sierdzio

      @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.

    • T

      Solved Saving memory by freeing off-screen QListView items?
      General and Desktop • sql qsqltablemodel model qlistview listview • • tague

      10
      0
      Votes
      10
      Posts
      490
      Views

      T

      @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.

    • M

      Unsolved Benefit of the model index
      General and Desktop • index model • • mix359

      4
      0
      Votes
      4
      Posts
      308
      Views

      V

      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

    • P

      Unsolved Table proxy model for list view
      General and Desktop • model view proxy • • Patrick Wright

      6
      0
      Votes
      6
      Posts
      2004
      Views

      P

      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.

    • N

      Unsolved Is it possible through qml javascript change the value of an delegate of a TableViewColumn?
      QML and Qt Quick • qml tableview tableviewcolumn model • • Nmaster88

      1
      0
      Votes
      1
      Posts
      269
      Views

      No one has replied

    • L

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

      1
      0
      Votes
      1
      Posts
      476
      Views

      No one has replied

    • J

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

      5
      0
      Votes
      5
      Posts
      1235
      Views

      J

      @VRonin That's really useful, thank you very much. Also I didn't know about the "Model test", that's nice too.

    • D

      Unsolved Tree View with varying column counts
      General and Desktop • qtreeview treemodel model model-view • • DaveK 0

      1
      0
      Votes
      1
      Posts
      623
      Views

      No one has replied