Talk:How to Use a QSqlQueryModel in QML

From Qt Wiki
Revision as of 15:55, 7 March 2016 by Calvev (talk | contribs) (Clarification on source code)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

This code has helped me so much, but I want to understand it further.

Could anyone help me with question about the codes (under generic approach):

1. Is "m_roleNames" a QSqlQueryModel private variable that is used internally?

  I didn't see it being called in "sqlquerymodel.cpp"

2. At "SqlQueryModel::data" function, why would the columnIdx derived from = role - Qt::UserRole - 1;

  Perhaps someone could share with me how does this function translate from QML role into QSqlQueryModel::data(modelIndex, Qt::DisplayRole);

Thanks,