Page 1 of 1

QStringView compare bug

Posted: Sat Mar 26 2022 6:50 pm
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.

Re: QStringView compare bug

Posted: Mon Apr 25 2022 2:36 am
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.