Results 1 to 2 of 2

Thread: Convert values in QListView

  1. #1
    Join Date
    Mar 2016
    Posts
    10
    Qt products
    Qt5
    Platforms
    Windows

    Default Convert values in QListView

    Hi!

    My QListView after SQL query has that list:
    40
    40002F
    40231S
    40297S

    And I want to convert all values that begin at 40 to 40, without duplication, so it should be:
    40

    Can you help me?

  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: Convert values in QListView

    Change your SQL:
    Qt Code:
    1. Select distinct substr(column, 1, 2)
    2. From tableofinterest
    3. Order by substr(column, 1, 2);
    4. -- or
    5. Select substr(column, 1, 2)
    6. From tableofinterest
    7. Group by substr(column, 1, 2)
    8. Order by substr(column, 1, 2);
    To copy to clipboard, switch view to plain text mode 

Similar Threads

  1. Replies: 5
    Last Post: 27th November 2014, 10:15
  2. Convert panned() parameters to plot values
    By TheBadger in forum Qwt
    Replies: 6
    Last Post: 13th June 2014, 09:54
  3. Replies: 6
    Last Post: 1st February 2013, 08:32
  4. How to convert string hex values to its real binary values?
    By AttilaPethe in forum Qt Programming
    Replies: 1
    Last Post: 20th February 2012, 22:47
  5. convert string to byte values
    By steg90 in forum Qt Programming
    Replies: 1
    Last Post: 22nd November 2007, 14:06

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.