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?
Forum Updated to NodeBB v4.3 + New Features

To String Conversion error?

Scheduled Pinned Locked Moved General and Desktop
6 Posts 4 Posters 1.6k 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 15 May 2013, 13:27 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
    • J Offline
      J Offline
      JohanSolo
      wrote on 15 May 2013, 13:36 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
      • R Offline
        R Offline
        raven-worx
        Moderators
        wrote on 15 May 2013, 13:37 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 15 May 2013, 13:42 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 15 May 2013, 13:50 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 16 May 2013, 05:09 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

              6/6

              16 May 2013, 05:09

              • Login

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