Sortorder Linux vs. Windows



  • Hello everyone!

    How does it come that if I sort my QStandardItemModel in Windows I get different results in Linux?

    For example Windows sorts my model like this:
    A, a, B, b,
    and Linux sorts like this:
    A, B, a, b,

    I use exactly the same code. Do I have to change something in Qt or Linux set some locale or change a parameter? Thats how i setup my Model:

    m_model->setSourceModel(m_baseModel);
    m_model->setDynamicSortFilter(false);
    m_model->setSortCaseSensitivity(Qt::CaseSensitive);
    m_model->setSortRole(Qt::DisplayRole);
    m_model->sort(0, Qt::AscendingOrder);
    m_model->setFilterCaseSensitivity(Qt::CaseInsensitive);
    m_model->setSortLocaleAware(true);
    

    Thanks in advance!
    Nex


  • Lifetime Qt Champion

    Hi,

    Are you using the same version of Qt on both platforms ?



  • Yes on linux and Windows I use Qt5.92

    On Linux the application is running on a small arm buildroot Linux. Is there maybe some locale missing in linux?



  • @nx7z
    Perhaps it's just me, but you seem to be calling the sort() before the setFilterCaseSensitivity(Qt::CaseInsensitive); & setSortLocaleAware(true);. Is this truly the code you are using for the result you are showing?


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.