Skip to content
Qt 6.12 LTS is out! See what's new in the release blog
  • QTableView does not update

    Solved General and Desktop tablemodel
    4
    0 Votes
    4 Posts
    5k Views
    N
    BINGO!!!! I added layoutAboutToBeChanged and layoutChanged signals to my insertRows method: bool ExclModel::insertRows(int row, int count, const QModelIndex & parent) { bool bRet=false; if (parent.isValid()) { // we always insert at the end... cerr << "insertRows" << ", exclVec.size "<< exclVec.size() << endl; emit layoutAboutToBeChanged(); beginInsertRows(parent,row,row+count-1); int ii; for (ii=0;ii<count;ii++) { exclItem itm;itm.strtT=0.0;itm.endT=0.0; exclVec.push_back(itm); } cerr << "end insertRows" << ", exclVec.size "<< exclVec.size() << endl; endInsertRows(); emit layoutChanged(); bRet=true; } return bRet; } AFAICT, the documentation does not mention this. I *think* it says you need those signals if you are doing sorting, but under the the insertRows method it says the following: If you implement your own model, you can reimplement this function if you want to support insertions. Alternatively, you can provide your own API for altering the data. In either case, you will need to call beginInsertRows() and endInsertRows() to notify other components that the model has changed. For clarity and naive dumb-asses like me, it should explicitly state the need for layout... signals.
  • Blank Relational Table Model GUI

    General and Desktop mysql tablemodel
    3
    0 Votes
    3 Posts
    2k Views
    D
    @ValentinMichelet Well this just made the header visible but no db data in the table anyway
  • 0 Votes
    1 Posts
    960 Views
    No one has replied
  • Problem about subclassing tableModel

    General and Desktop tablemodel
    2
    0 Votes
    2 Posts
    1k Views
    SGaistS
    Hi and welcome to devnet, Your while loop is blocking everything. You should rather implement this asynchronously. So set rowNumber to 0 at the beginning and when you get your data and update the model then you can trigger the appropriate signals that will tell the views to refresh themselves so that rowCount and friends will be called with the newly arrived values. Hope it helps