Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. I'm calling toStdString on a QStringRef
Qt 6.11 is out! See what's new in the release blog

I'm calling toStdString on a QStringRef

Scheduled Pinned Locked Moved Solved General and Desktop
3 Posts 2 Posters 1.1k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    Maarten Verhage
    wrote on last edited by
    #1

    Hi all,

    I'm calling toStdString() on a QStringRef in Qt 5.3.2 and it is working but according to the documentation QStringRef doesn't have this member function, not even inherited. How come it still works?

    Best regards.

    1 Reply Last reply
    0
    • ? Offline
      ? Offline
      A Former User
      wrote on last edited by
      #2

      Hi!

          QString s("test");
          QStringRef r(&s);
          qDebug() << r.toStdString();
      

      Doesn't compile for me with Qt 5.9.1 on x86-64 desktop Linux.

      M 1 Reply Last reply
      3
      • ? A Former User

        Hi!

            QString s("test");
            QStringRef r(&s);
            qDebug() << r.toStdString();
        

        Doesn't compile for me with Qt 5.9.1 on x86-64 desktop Linux.

        M Offline
        M Offline
        Maarten Verhage
        wrote on last edited by
        #3

        @Wieland I'm very sorry. I missed a line of code where I converted it to a QString. Silly mistake.

        1 Reply Last reply
        0

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved