3

rant == needHelp(c++/Qt)

Ok, so I want to pass a pointer to my main class like

CSprite2D::CSprite2D(int number, Ui::MainWindow *i = 0) //gets the number of total sprites from MainWindow
{
number_sprite = number;
ui = i;

QTreeWidgetItem *item = new QTreeWidgetItem;
item->setText(0, "Node 2D " + number_sprite);
ui->treeWidget_2->items.append(item);
}

But I get an error (blablabla doesn't have a class type)

I know, some people hate it, when others use devRant as StackoverFlow, but I can't get any good results off SO, as I always get downvoted for some minor stuff

Comments
  • 0
    @Artemix What are those? Can I has explainer?
  • 1
    Problem should be that you try to concat a const char pointer with an integer.
    I would do it like this
    std::string("some text ") += std::to_string( numbers )
    Or use the std::ostringstream to assemble the parts.
  • 0
    @krister-alm no, thats not the problem, the problem is one point after... It is, because the pointer "has no class type"
Add Comment