Sorry for my english. I need to change the text qlabel dynamically.
class Game:
{
...
std::shared_ptr<QWidget> m_hint;
QLabel *m_label;
QHBoxLayout *m_layout;
}
void Game::setTextToHint(std::string str)
{
m_label = new QLabel();
m_layout = new QHBoxLayout();
m_label->setText(QString::fromUtf8(str.c_str()));
m_layout->addWidget(m_label);
m_hint->setLayout(m_layout);
}
And i use this function eg twice:
setTextToHint("One");
setTextToHint("First");
But ultimately label = "One"
Ok i understood. I just suffered in class constructor.
m_label = new QLabel();
m_layout = new QHBoxLayout();
But question is actually:
Still I would like to ask to use stl smart pointers this qt object not good. I can not use smart pointers from the library QT only STL. What do i do?