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. To String Conversion error?
Qt 6.11 is out! See what's new in the release blog

To String Conversion error?

Scheduled Pinned Locked Moved General and Desktop
6 Posts 4 Posters 3.2k 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.
  • I Offline
    I Offline
    itsmemax
    wrote on last edited by
    #1

    @NOUElement.appendChild( xmlDocument.createTextNode(ui->tableWidget_5->rowCount().toString()));@

    @'((MainWindow*)this)->MainWindow::ui->Ui::MainWindow::<anonymous>.Ui_MainWindow::tableWidget_5->QTableWidget::rowCount()', which is of non-class type 'int'@

    Help please?

    1 Reply Last reply
    0
    • JohanSoloJ Offline
      JohanSoloJ Offline
      JohanSolo
      wrote on last edited by
      #2

      Well, AFAIK there is no toString() function defined for integer type... You may be looking for QString::number()

      `They did not know it was impossible, so they did it.'
      -- Mark Twain

      1 Reply Last reply
      0
      • raven-worxR Offline
        raven-worxR Offline
        raven-worx
        Moderators
        wrote on last edited by
        #3

        you are calling toString() on an integer ?!
        Edit: too slow :)

        --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
        If you have a question please use the forum so others can benefit from the solution in the future

        1 Reply Last reply
        0
        • I Offline
          I Offline
          itsmemax
          wrote on last edited by
          #4

          Epic, I come from the visual basic edge of this world, you know? :P I'm not that familiar with C++. What can I do to put the rowCount in the Element? Somehow I have to convert it in a string.

          1 Reply Last reply
          0
          • I Offline
            I Offline
            itsmemax
            wrote on last edited by
            #5

            Okay, I've found it in the documentation.
            @QString numberOfRows = QString::number(ui->tableWidget_5->rowCount());@

            Thanks!

            1 Reply Last reply
            0
            • Q Offline
              Q Offline
              qxoz
              wrote on last edited by
              #6

              Hi!
              Also you can:
              @QString numberOfRows;
              numberOfRows.setNum(ui->tableWidget_5->rowCount())@
              or
              @QString numberOfRows = QString("%1").arg(ui->tableWidget_5->rowCount());@
              or
              @QLocale loc;
              QString str = loc.toString(ui->tableWidget_5->rowCount());@

              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