How to set Qt::Vertical headerData of QSqlQueryModel increasing numbers when doing pagination
-
im doing simple pagination with QSqlQueryModel select from limit query's
every thing is working fine . but. now i like to reflect the Vertical headerData of the QTableView .
im implementing the headerData , beacose it is const function i can't do any calculation inside it . so i have problem to calculate the right numbers in the Vertical headers. for example is im getting the rows from 20 to 30 .
i like the Vertical header show the numbers 20 to 30 . and so on ...
this is how i implement the headerData@QVariant PlayListSqlModel::headerData(int section, Qt::Orientation orientation, int role) const
{if(orientation == Qt::Vertical && role == Qt::DisplayRole) { return section; } if (role == Qt::DisplayRole) { if (orientation == Qt::Horizontal) { switch (section) { case 0: return QString("name"); case 1: return QString("From"); case 2: return QString("Created Time"); case 3: return QString("last name"); case 4: } } } return QVariant();
}@
-
wat error u are getting?
-
error C2166: l-value specifies const object
-
"case 4" does not have a statement. You must add a regular statement/return statement or just break.