I used QThread::currentThread() and it seems that I am getting the slot calls in to the main GUI thread as it have to be but the problem still exist.
In my case I create a QTreeWidget and I put items in it. I create it like this:
void MainWindow::onLoginSuccess() // slot
{
// 'this' is a pointer to a QMainWindow
TreeWidget->show();
}
void MainWindow::onLoginSuccess() // slot
{
// 'this' is a pointer to a QMainWindow
QTreeWidget *TreeWidget = new QTreeWidget(this->ui.centralwidget);
TreeWidget->show();
}
To copy to clipboard, switch view to plain text mode
In this way it will not show up, I will have to call setAutoFillBackground(true) before show in order to get the QTreeWidget visible. Ok I can live with that but when I add a items they are not showing up until I don't do hide(), show() calls to the QTreeWidget. I have connected the slot like this:
// g_document.getListener() returns a pointer to the Callback API
connect( g_document.getListener(), SIGNAL(loginSuccess()), this, SLOT(onLoginSuccess()), Qt::QueuedConnection );
// g_document.getListener() returns a pointer to the Callback API
connect( g_document.getListener(), SIGNAL(loginSuccess()), this, SLOT(onLoginSuccess()), Qt::QueuedConnection );
To copy to clipboard, switch view to plain text mode
But if I create the QTreeWidget for example in to the constuctor of the MainWindow it will work just fine and I am able to add items via slots that are called from the other external library thread using QObject::connect().
Bookmarks