PDA

View Full Version : i want to order a table in my database with the id



chams
22nd November 2017, 10:52
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

high_flyer
22nd November 2017, 11:32
Is your table table a QTableWidget or a QTableView?

chams
22nd November 2017, 12:48
hello;
it is QtableView !!


thank you for your help !!

high_flyer
22nd November 2017, 14:39
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-itemviews-customsortfiltermodel-example.html

Ask here if you have *specific* questions.