xeyos
26th July 2014, 20:50
Hi, im developing a small desktop application from my ubuntu qtCreator.. and ive having an error im not able to solve.
this is the relevant code:
QWidget *nw = new QWidget();
std::string final = "some text here";
QLabel *lblText = new QLabel(QString::fromStdString(final));
QVBoxLayout *mainLayout = new QVBoxLayout;
mainLayout->addWidget(lblText);
nw->setLayout(mainLayout);
ui->tabNews->addTab(nw, tr("Confirmation"));
the error is:
QObject::setParent: Cannot set parent, new parent is in a different thread
ive previosly done a custom widget on a ui file and tried to load it on that tab with the same result and tried to create the widget on the same class where this window is created... with the same result.
Can anyone see the problem with this little code? :S im not explicitelly using threads on the view layer...
this is the relevant code:
QWidget *nw = new QWidget();
std::string final = "some text here";
QLabel *lblText = new QLabel(QString::fromStdString(final));
QVBoxLayout *mainLayout = new QVBoxLayout;
mainLayout->addWidget(lblText);
nw->setLayout(mainLayout);
ui->tabNews->addTab(nw, tr("Confirmation"));
the error is:
QObject::setParent: Cannot set parent, new parent is in a different thread
ive previosly done a custom widget on a ui file and tried to load it on that tab with the same result and tried to create the widget on the same class where this window is created... with the same result.
Can anyone see the problem with this little code? :S im not explicitelly using threads on the view layer...