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

  • SEARCH
  • Home
  • 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 6927543
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T11:04:08+00:00 2026-05-27T11:04:08+00:00

I have issues while using sortItems() on a QListWidget. Here is what happens: Changes

  • 0

I have issues while using sortItems() on a QListWidget. Here is what happens:

Changes this:

A
z
d
C
E
o
I

to this:

A
C
I
d
e
o
z

But i want it to be:

A
C
d
e
I
o
z

Any way to change to make it sort like that?

  • 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-05-27T11:04:09+00:00Added an answer on May 27, 2026 at 11:04 am

    QListWidget uses the DisplayRole (the item’s text) for sorting and calls
    QString::localeAwareCompare on them. To override the default, you can either change the locale used (see QLocale) or have your own QListWidgetItem subclass reimplementing QListWidgetItem::operator< and let it do the comparison you want.

    For anything more advanced, I’d suggest to have a look at QListView, which you could combine either with your own model implementation or the convenience models QStandardItemModel or QStringListModel (the latter could be the most simple and elegant solution in your case). For sorting, you would then put a QSortFilterProxyModel in between the actual model and the view.

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

Sidebar

Related Questions

I have been using youtube-dl for a while now with no issues, but now
I have been using Jira since 6months but haven;t been through any document related
There are numerous discussions here that have addressed issues that seem related to this
I've been using MIME::Lite for a short while now and have had no issues
I have an odd issue while using FlashCS4. I have a textfield that, when
First of all: I'm at Scala 2.8 I have a slight issue while using
We have issues within an application using a state machine. The application is implemented
While developing for multiple sets of browsers, what issues have you faced while development
This has probably been asked before but I can't find it anywhere. I have
I am currently having issues uploading files to amazon S3 while using paperclip. It

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.