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. [Solved] Quotes included when gets info from QListWidgetItem.
Forum Updated to NodeBB v4.3 + New Features

[Solved] Quotes included when gets info from QListWidgetItem.

Scheduled Pinned Locked Moved General and Desktop
4 Posts 2 Posters 914 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.
  • R Offline
    R Offline
    Rhadel
    wrote on last edited by
    #1

    I add QStrigs to QListWidgetItem (custom) as follows:

    @

    QList<QString> CustomItem::listItemsAvailable = QList<QString>() << QString("One")
    << QString("Two")
    << QString("Three);
    @

    When I try to get the selected item, as follows:

    @
    QString text = currentItem()->text();
    qDebug () << text;
    @

    I returns the selected List Item, but with quotes, so, qDebug() writes: "One", for example. With qoutes.

    How it comes?

    Thank you.

    1 Reply Last reply
    0
    • JKSHJ Offline
      JKSHJ Offline
      JKSH
      Moderators
      wrote on last edited by
      #2

      Your string does not contain quotes.

      QDebug prints quotes around all QStrings.

      @
      QString qstr("Hello");
      qDebug() << "Hello" << qstr;
      @
      gives

      @
      Hello "Hello"
      @

      Qt Doc Search for browsers: forum.qt.io/topic/35616/web-browser-extension-for-improved-doc-searches

      1 Reply Last reply
      0
      • R Offline
        R Offline
        Rhadel
        wrote on last edited by
        #3

        Oh boy, thank you, and sorry for that.

        1 Reply Last reply
        0
        • JKSHJ Offline
          JKSHJ Offline
          JKSH
          Moderators
          wrote on last edited by
          #4

          You're welcome, and no need to be sorry! We all learn by asking questions. :)

          Qt Doc Search for browsers: forum.qt.io/topic/35616/web-browser-extension-for-improved-doc-searches

          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