Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9028195
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T06:55:36+00:00 2026-06-16T06:55:36+00:00

I have created a QTable view and connected it to a QSqlTableModel and i

  • 0

I have created a QTable view and connected it to a QSqlTableModel and i am displaying the resulted Query retrived from the database.In QTable view i have enabled sortEnabled option. All the expected results are printing but if i click the sort indicator
the whole data in the table is getting emptyed. Can any one suggest me how to overcome this issue

This is the snap shot of the results table.

snap shot of the results

This is the snap shot of the results table after pressing sort indicator.

results after pressing sort indicator

Can any one suggest me how to overcome this issue

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T06:55:37+00:00Added an answer on June 16, 2026 at 6:55 am

    To figure out why QTableView’s setSortingEnabled method wasn’t working is, It turns out the sort method in QAbstractItemModel is not implemented. So you have to implement it yourself.

    One solution would be creating a QAbstract view. below is a code snippet.

    I’m not sure if this is the best way to implement the sort method, but I couldn’t find anything else out there, and this seems to work for me.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have created 3 classes as following Ext.mine.TextParent - Inherting from Textfield Ext.mine.child.TextChildA -
Have created simple Ajax enabled contact forms before that have around 12 fields -
I have created a very simple REST controller in Symony2 with Database insert/updates/deletes in
I have created a google map displaying markers and the weather layer using Google
Have created a small two tab app, then subclassed another view controller to create
I have a SQLite-Database and I did it into a QSqlTableModel . To show
I have created a web reference (Add Web Reference) from Visual Studio 2008 and
I have created an IEnumerable list of racing drivers using LINQ from a string
I have created a view controller, and added a table view as a subview
I have created a View call PhotoView with a PhotoviewModel it is bind to.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.