How would you translate table name and field name from database?
for example i would like to have QSqlTableModel with QTabelView but column names in view translatable
is there a proper way with tr(), or some hack/trick that someone knows?
How would you translate table name and field name from database?
for example i would like to have QSqlTableModel with QTabelView but column names in view translatable
is there a proper way with tr(), or some hack/trick that someone knows?
You can set the headers that the QSqlTableModel serves up using QSqlTableModel::setHeaderData(). Views will generally display these unaltered. See the first example in the QSqlTableModel docs.
OK, thanks, somehow i missed that
that works if i know the table name, what if i have generic form where user selects table name, form for direct database editing, i dont know filed names yet, where do i intervene
also, if i have some text data from database, that should be translated also,
for example table `item_type` that is fk on table `item` and i have QComboBox where i select type and user sees strings loaded from database, how do i translate those strings
somehow tr() seams insufficient, or i am missing something, and there is a way to add more dynamic translations with tr
Or i shoud create my own tr(), and maintain all translations table in database, without .ts and .qm files
EDIT
For those with similar problems there is a great document on
http://doc.qt.digia.com/qq/qq03-swedish-chef.html
and since the link can change the document is titled
Forgot a tr()?
by Jasmin Blanchette
so you can google it
I can subclass QTranslator to search for messages in database, use fake c++ code....
Last edited by davidovv; 30th January 2014 at 09:41.
Bookmarks