Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-13244

QString::fromUtf16 cannot be replaced with QString(const ushort *, int)

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P3: Somewhat important
    • 4.7.1
    • 4.5.3
    • Documentation
    • None
    • 9ec7bbcb96149b1ce8a2d62b55c824d71ff292a8

    Description

      Reading the documentation for QString::fromUtf16 [1]:
      > This function is comparatively slow. Use QString(const ushort *, int) if possible.

      So I did, and here is what I got:
      > main.cpp:97: error: invalid conversion from 'const ushort*' to 'int'
      > main.cpp:97: error: initializing argument 1 of 'QString::QString(int, QChar)'

      Note that the documentation page for QString does not mention QString(const ushort *, int). The following constructors are documented:

      QString ()
      QString ( const QChar * unicode, int size )
      QString ( QChar ch )
      QString ( int size, QChar ch )
      QString ( const QLatin1String & str )
      QString ( const QString & other )
      QString ( const char * str )
      QString ( const QByteArray & ba )

      The constructor QString ( const QChar * unicode, int size ) seems most appropriate; however, I think that having QString ( const ushort* unicode, int size ) would be a good thing.

      [1] <URL:http://doc.trolltech.com/4.6/qstring.html#fromUtf16>

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            jerome.pasion Jerome Pasion
            yecril71pl Christopher Yeleighton
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes