To String Conversion error?



  • @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?



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


  • Moderators

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



  • 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.



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

    Thanks!



  • 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());@


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.