I finally realized.
Qt Code:
qDebug() << ui->graphicsView->size(); this->map = new Mercator_graphics_item(ui->graphicsView->size()); qDebug() << map; ui->graphicsView->update(); draw_scene->addItem(map); draw_scene->update(); ui->graphicsView->setScene(draw_scene);To copy to clipboard, switch view to plain text mode
the pointer map is declared in the header file...
Using the new operand I allocate the map object in the Heap so it is not destroyed at the and of the slot's stack.
Am I right or it works only by chance?
Bookmarks