Results 1 to 3 of 3

Thread: translate database column names

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Dec 2009
    Posts
    65
    Thanks
    10
    Thanked 4 Times in 4 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows Android

    Default translate database column names

    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?

  2. #2
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: translate database column names

    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.

Similar Threads

  1. Replies: 0
    Last Post: 1st June 2013, 22:14
  2. list tables column name (database)
    By baray98 in forum Qt Programming
    Replies: 1
    Last Post: 26th September 2012, 11:18
  3. SQL Query column names
    By rakkar in forum Newbie
    Replies: 1
    Last Post: 9th September 2009, 19:06
  4. Replies: 5
    Last Post: 13th November 2008, 13:43
  5. MySQL column names extraction
    By MarkoSan in forum Qt Programming
    Replies: 2
    Last Post: 12th October 2007, 11:51

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.