Problems with Open-Source Downloads read https://www.qt.io/blog/problem-with-open-source-downloads and https://forum.qt.io/post/638946

Need some help on QTableview Sorting : SQLTableModel + Qtableview + Sorting Varchar as number



  • Hello,
    Thanks for taking time to read my post. I have a MySQL table with memberid as varchar column. I need to sort it as an integer (Eg. 1, 2, 3 etc) instead of (1, 10, 11... 2). I have read that MySQL has a ORDER BY CLAUSE. (My data is a collection of alphabet and numbers eg AF1, AF10, AF11..AF19, AF2)

    I have also enabled in QTableview : set sorting enabled to true.

    The Question is : How can i enable sorting when the Headerview is clicked to enable the sorting using the ORDER BY CLAUSE.

    Please help.


Log in to reply