Navigation

    Qt Forum

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

    • SOLVED How to recent signal from proxyModel to model?
      General and Desktop • qtableview qsortfilterprox qabstracttablem • • zloi_templar  

      4
      0
      Votes
      4
      Posts
      44
      Views

      @VRonin yea, ty, already fix it
    • SOLVED Trying to programatically fill a model for QTableView
      General and Desktop • qtableview qabstracttablem • • aramaz  

      3
      0
      Votes
      3
      Posts
      56
      Views

      @Bonnie said in Trying to programatically fill a model for QTableView: Yes, the life cycle is definitely a problem. You should show the code when making the tabletModel a member of MainWindow. And there's no need to call show() when appending data. It turns out I was not initializing the table model in the constructor when making it a member. and you are correct the show() isn't needed. Now it all works. Thanks again!
    • UNSOLVED QTableView vs subclassing QAbstractTableModel
      General and Desktop • qtableview qtreewidget modelview qabstracttablem • • Electric-Gecko  

      4
      0
      Votes
      4
      Posts
      2787
      Views

      You can use either QTreeWidget, QTableWidget, QTreeView+QStandardItemModel, QTableView+QStandardItemModel, QTreeView+QAbstactTableModel subclass, QTableView+QAbstactTableModel subclass for what you are trying to do. I would go with a QT*View+QStandardItemModel (tree or table doesn't matter). The functionalities you describe are: only some columns will be editable use QStandardItem::setFlag Entering a value in the cents column (a logarithmic measure of frequency) will change the value in the hertz column, and vice versa connect a slot to QStandardItemModel::dataChanged signal There will be a button next to the table to add an additional note to the scale connect a slot that calls QStandardItemModel::insertRows to the QPushButton::clicked signal
    • UNSOLVED QAbstractTableModel hard to set up
      General and Desktop • qtableview qtablewidget model-view qabstracttablem qtablewidgetite • • moffa13  

      3
      0
      Votes
      3
      Posts
      1039
      Views

      In 90% of the cases you can use QStandardItemModel instead of going through the minefield that is subclassing an abstract model. My advice is just to use that "universal model" instead of a custom one. If you really, really want to customise it as performance of QStandardItemModel is a problem then make sure you run your model through the Model Test (needs just a couple of trivial fixes to work on Qt5) that will tell you if you did everything as you were supposed to or you fell in the countless pitfalls of model subclassing
    • SOLVED Custom QAbstractTableModel class updating QTableView
      General and Desktop • c++ qt5 qtableview qabstracttablem datachanged • • Sebbo  

      13
      0
      Votes
      13
      Posts
      3990
      Views

      @raven-worx Jackpot! Thank you so much for your help!! Finally I did it using QFileSystemWatcher. Thumbs up for you (if possible?!). :) Thread marked as solved. Cheers
    • UNSOLVED [SOLVED]QTableModel crashes on headerData
      General and Desktop • model-view qabstracttablem • • RDiGuida  

      10
      1
      Votes
      10
      Posts
      2795
      Views

      @RDiGuida Ok, so cnamMet would run out of scope and be deleted (when function ended) but sounds like data.rnames should have been working. Well if a copy on creation time works for you, its a wrap :)
    • Row selection
      General and Desktop • c++ qtableview qt5.4 selection row qabstracttablem • • sigsevg  

      3
      0
      Votes
      3
      Posts
      1027
      Views

      Hi, thanks for the reply. Yes, I set that flag to true but I can select a row by clicking indivual cell or horizontal header. I've overriden flags function in my model if I remove isSelectable flag i can't select anything. Qt::ItemFlags TableModel::flags(const QModelIndex &index) const { if(!index.isValid()) { return Qt::ItemIsEnabled; } if(index.column() == 1) { if(modelList.at(index.row()).isArray) { return Qt::ItemIsEnabled | Qt::ItemIsUserCheckable | Qt::ItemIsEditable; } return Qt::ItemIsEnabled | Qt::ItemIsUserCheckable; } return Qt::ItemIsEnabled | Qt::ItemIsEditable | Qt::ItemIsSelectable; }
    • trying to use multiple columns with qml Tableview & QAbstractTableModel
      QML and Qt Quick • tableview qml dynamic qabstracttablem • • zeryx  

      3
      0
      Votes
      3
      Posts
      1236
      Views

      Hi @zeryx I've tried your code with the change below and it works fine (columns are getting populated at runtime) use var headerData = baseTableModel.headerList instead of var headerData = headers at line number 11 in schedulerViewingPane.qml (http://hastebin.com/genuhisodu.sm). Since you are already passing EmployeeModelTable instance baseTableModel to the qml then why not use the headerList property from the instance instead of setting it again.
    • QAbstractTableModel, headerData() never gets called, how to set headers properly?
      General and Desktop • qabstracttablem • • Lars_-.  

      7
      0
      Votes
      7
      Posts
      4812
      Views

      Qt provides Q_DECL_OVERRIDE which extends to the override keyword if C++11 is used and to nothing otherwise