Results 1 to 4 of 4

Thread: i want to order a table in my database with the id

  1. #1
    Join Date
    Nov 2017
    Posts
    6
    Qt products
    Qt4
    Platforms
    Windows

    Exclamation i want to order a table in my database with the id

    i'm looking for the code to order the elements in a table in my database with the id of the element increasing from 1...n

  2. #2
    Join Date
    Jan 2006
    Location
    Munich, Germany
    Posts
    4,714
    Thanks
    21
    Thanked 418 Times in 411 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: i want to order a table in my database with the id

    Is your table table a QTableWidget or a QTableView?
    ==========================signature=============== ==================
    S.O.L.I.D principles (use them!):
    https://en.wikipedia.org/wiki/SOLID_...iented_design)

    Do you write clean code? - if you are TDD'ing then maybe, if not, your not writing clean code.

  3. #3
    Join Date
    Nov 2017
    Posts
    6
    Qt products
    Qt4
    Platforms
    Windows

    Smile Re: i want to order a table in my database with the id

    hello;
    it is QtableView !!


    thank you for your help !!

  4. #4
    Join Date
    Jan 2006
    Location
    Munich, Germany
    Posts
    4,714
    Thanks
    21
    Thanked 418 Times in 411 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: i want to order a table in my database with the id

    based on your question style, my guess is that you are not very experienced with Qt or C++.
    I would urge you to make sure QTavleWidget does not meet your needs since it has sorting built in to it.
    If it must be a QTableView, then you have to use a sorting proxy model.
    See here on how:
    http://doc.qt.io/qt-5/qtwidgets-item...l-example.html

    Ask here if you have *specific* questions.
    ==========================signature=============== ==================
    S.O.L.I.D principles (use them!):
    https://en.wikipedia.org/wiki/SOLID_...iented_design)

    Do you write clean code? - if you are TDD'ing then maybe, if not, your not writing clean code.

Similar Threads

  1. How to create mysql database table in Qt?
    By vivek31 in forum Newbie
    Replies: 2
    Last Post: 4th December 2015, 00:50
  2. drag and drop to change order in a table
    By knobby67 in forum Newbie
    Replies: 0
    Last Post: 11th September 2014, 11:57
  3. Restore table sort order after app restart
    By aguayro in forum Qt Programming
    Replies: 0
    Last Post: 21st August 2012, 19:20
  4. Insert values into database table
    By l0ner in forum Newbie
    Replies: 3
    Last Post: 20th June 2011, 19:03
  5. QStandardItemModel to sqlite database table
    By sattu in forum Qt Programming
    Replies: 19
    Last Post: 10th March 2011, 23:01

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.