Results 1 to 2 of 2

Thread: QTableView::sortByColumn locale-aware sorting

  1. #1
    Join Date
    Sep 2009
    Posts
    8
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default QTableView::sortByColumn locale-aware sorting

    Hello!
    Please, is there any way to tell QTableView::sortByColumn to use locale-aware sorting? I`m using QSqlTableModel to display table content. I`m from Czech Republic and I need to sort records like this:

    Qt Code:
    1. nana
    2. nána
    3. nene
    To copy to clipboard, switch view to plain text mode 


    Thanks a lot for any suggestions

  2. #2
    Join Date
    Sep 2009
    Posts
    8
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QTableView::sortByColumn locale-aware sorting

    I am sorry for posting question before deeply search in documentation. This problem has very easy solution, otherwise I decided to left there my post with it:

    Qt Code:
    1. QTableView *view = new QTableView(this);
    2. QSqlTableModel *model = new QSqlTableModel(this);
    3. // set table for model
    4. QSortFilterProxyModel *sortProxyModel = new QSortFilterProxyModel(this);
    5. sortProxyModel->setSortLocaleAware(true);
    6. sortProxyModel->setSourceModel(model);
    7. view->setModel(sortProxyModel);
    To copy to clipboard, switch view to plain text mode 

Similar Threads

  1. QTableView sorting
    By gabriels in forum Qt Programming
    Replies: 11
    Last Post: 6th October 2010, 17:13
  2. Replies: 5
    Last Post: 23rd December 2009, 01:53
  3. Locale-aware QString::contains()
    By victor.fernandez in forum Qt Programming
    Replies: 1
    Last Post: 25th November 2009, 17:58
  4. QTableView sorting
    By Bojan in forum Newbie
    Replies: 2
    Last Post: 28th September 2006, 08:11
  5. Sorting QTableView
    By Jimmy2775 in forum Qt Programming
    Replies: 7
    Last Post: 9th February 2006, 16:47

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
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.