Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QSqlTableModel - setting default values using the primeInsert signal.
Forum Updated to NodeBB v4.3 + New Features

QSqlTableModel - setting default values using the primeInsert signal.

Scheduled Pinned Locked Moved Unsolved General and Desktop
qt5.5qsqltablemodel
1 Posts 1 Posters 773 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    mawh1960
    wrote on last edited by mawh1960
    #1

    In my model I have a primeInsert() signal handler that sets a default value:

    void MySqlTable::onPrimeInserted(int row, QSqlRecord &r) {
    r.setValue(numberCol, row + 1);
    }

    If the model is later submitted(), the modified value is not saved.
    However, I found that if I call setGenerated(), the value does indeed get saved.

    void MySqlTable::onPrimeInserted(int row, QSqlRecord &r) {
    r.setValue(numberCol, row + 1);
    r.setGenerated(numberCol, true);
    }

    Is this the intended behavior for how setting values using primeInsert is supposed to work? Doesn't seem right somehow.
    Regards,
    Mike

    1 Reply Last reply
    0

    • Login

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Get Qt Extensions
    • Unsolved