problem when using qstackwidget->setCurrentIndex
-
Dear Sir,
I have meet a problem when i using qstackwidget. First i new 10 Qwidget to fill the qstackwidget. And actually when i using the qstackwidget, I remove the old one and insert a new one.And the inserted one cantains a quickwidget.
int i;
for(i=0;i<APP_KEYSTUDY+1;i++)
{
ui->stackedWidget->addWidget(new QWidget(this));
}mMainWindow->getStackedWidget()->removeWidget(mMainWindow->getStackedWidget()->widget(appIndex));
mMainWindow->getStackedWidget()->insertWidget(appIndex,mApps->at(appIndex)->getContent());so the problem is when i using setCurrentIndex to switch page,there is not respond, nothing happen,the screen is black and not picture show.
mMainWindow->getStackedWidget()->setCurrentIndex(appIndex);
And when i use gdb to debug this, is shows like below:
#0 0xb25666e34 in __libc_do_syscall() from /lib/libpthread.so.0
#1 0xb256727a8 in pthread_cond_wait@@GLIBC_2.4() from /lib/libpthread.so.0
#2 0xb25d8ae6 in _mali_osu_lock_wait () from /usr/lib/libGLESv2.so
#3 0xb25d8ae6 in _mali_frame_builder_wait () from /usr/lib/libGLESv2.0.so
#4 0xb25alc82 in _gles_finish() from /usr/lib/libGLESv2.so
#5 0xb25982c4 in glFinish() from /usr/lib/libGLESv2.so
#6 0xb3e51b98 in ?? () from /usr/local/Qt-5.9.7/lib/libQt5QuickWidgets.so.5That is the problem,please help to resovle.
Thanks & Best regards! -
@MarkLuo said in problem when using qstackwidget->setCurrentIndex:
mApps->at(appIndex)->getContent()
Code should work. Only issue I could see is mApps->at(appIndex)->getContent(). See if this returns the correct widget or null ?
-
@dheerendra ok, I will check for this.Thanks!
-
@dheerendra
HI Dheerendra,
When our machine startup normal, there are 24 threads. But if the problem happens, there are only 14 threads. So I guess there must be somewhere blocked. And according to the log, it is here:
mMainWindow->getStackedWidget()->setCurrentIndex(appIndex);So is it because of the function named pthread_cond_wait ?
Thanks for your help! -
@dheerendra said in problem when using qstackwidget->setCurrentIndex:
at(appIndex)->getContent().
hi dheerendra,
I have checked that getContent() return the correct Widget, any advice?