Lost My Qt Widgets StyleSheets
-
I'm giving up... provide code where we can reproduce the problem!
and btw: you must not do any gui oeration outside the main thread.
-
but way i can't use Any GUI controls in QFuture Thread ?
-
@Ketan__Patel__0011 said in Lost My Qt Widgets StyleSheets:
but way i can't use Any GUI controls in QFuture Thread ?
Because it's not supported. UI may only be accessed from UI thread.
This is mentioned in the documentation: https://doc.qt.io/qt-5/thread-basics.html -
@Ketan__Patel__0011
No: how would it be possible to "run something in parallel" within the one GUI thread? Not to mention: why would you need to/bother anyway?This is quite separate from running any non-GUI threads in parallel with the GUI thread.
-
@Ketan__Patel__0011 said in Lost My Qt Widgets StyleSheets:
is it possible to run one or more function parallel in GUI thread ?
Of course not. But why do you want to do this? Simply do your heavy stuff in parallel threads and emit signals there if UI needs to do something. And in the UI thread you connect to these signal and do what needs to be done. This is how this is done properly...
-
@Ketan__Patel__0011 Can you explain exact problem you have now? The thread is a bit old already.
-
@Ketan__Patel__0011 Then you will need to show what you are doing with stylesheets
-
I am just changing my buttons or other controls stylesheet based of some condition..
likeif(IS_ Button_1_Clicked == true) { ui->pushbutton_1->setStyleSheet(MY_FIRST_STYLE); } else { ui->pushbutton_1->setStyleSheet(MY_SECOND_STYLE); }
-
Hi
Are you trying to update the stylesheets?Normally for dynamic properties in stylesheet one can do
widget->style()->unpolish(widget); widget->style()->polish(widget); QEvent event(QEvent::StyleChange); QApplication::sendEvent(widget, &event); widget->update(); widget->updateGeometry();
Im not sure its what's wrong in your case.
Is the stylesheet inline strings or do you load them from file? -
K Ketan__Patel__0011 has marked this topic as solved on
-
@Ketan__Patel__0011 : how you find out where is the issue? any debug strategy you used, that would be helpful.
-
@Hardy91 Simply don't modify ui elements from outside the main (ui) thread...