-1

This is the code that i do:

`void Tabella::on_pushButton_clicked()
{
    int risultato;
    risultato = ui->treeWidget->currentItem()->text(2);
    ui->out_3->setText(QString::number(risultato));

}`

Are the any ways to assign the code into variable? Like that?

P.S I'm new in QT, i worked with c++ and java.

Shifenis
  • 1,056
  • 11
  • 22
  • Where's the problem? Couldn't you say that the compiler complained because you were trying to convert `QString` to `int`? Couldn't you read that error message and do something? Why do you need to go through `int`, anyway? – LogicStuff May 28 '16 at 09:09
  • Realy, my problem is that i can put what i want in variable no the cast... – Shifenis May 28 '16 at 20:14

1 Answers1

0

Try this:

ui->out_3->setText(ui->treeWidget->currentItem()->text());

You make take a look at this question

Mara Black
  • 1,666
  • 18
  • 23