QStringView compare bug

Discuss anything related to product development
Post Reply
seasoned_geek
Posts: 254
Joined: Thu Jun 11 2020 12:18 pm

QStringView compare bug

Post by seasoned_geek »

Code: Select all

        Qt::CaseSensitivity sens = noCase ? Qt::CaseInsensitive : Qt::CaseSensitive;
        bool retVal = false;
        int  rslt = 0;

        if ( column < 1 )
        {
            rslt = a.compare( b, sens );
        }
        else
        {
            int pos = column - 1;
            QStringView aView( a.midView( pos ) );
            QStringView bView( b.midView( pos ) );
            rslt = aView.compare( bView, sens );
compare for QString handles a CaseSensitivity variable parameter just fine. QStringView, not so much.

Code: Select all

home/roland/sf_projects/reddiamond/src/edtbasewidget.cpp: In lambda function:
/home/roland/sf_projects/reddiamond/src/edtbasewidget.cpp:3591:47: error: no matching function for call to ‘Cs::QStringView<QString8>::compare(QStringView&, Qt::CaseSensitivity&)’
 3591 |             rslt = aView.compare( bView, sens );
      |                                               ^
In file included from /usr/lib/cs_lib/include/QtCore/qstringview.h:29,
                 from /usr/lib/cs_lib/include/QtCore/qstring8.h:34,
                 from /usr/lib/cs_lib/include/QtCore/csmeta_internal_1.h:28,
                 from /usr/lib/cs_lib/include/QtCore/csmeta.h:28,
According to this doc

https://www.copperspice.com/docs/cs_api/class_qstringview.html

That should work.
ansel
Posts: 153
Joined: Fri Apr 10 2015 8:23 am

Re: QStringView compare bug

Post by ansel »

The QStringView::compare() method was added in January of 2022 which was just after the release of CopperSpice 1.7.3. This method will be present in CopperSpice 1.7.4, which is scheduled to be released by the end of April 2022.
Ansel Sermersheim
CopperSpice Cofounder
Post Reply