Lost My Qt Widgets StyleSheets
-
@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.htmlis it possible to run one or more function parallel in GUI thread ?
-
is it possible to run one or more function parallel in GUI thread ?
@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.
-
is it possible to run one or more function parallel in 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 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...
Hiii
As you say i was change my code
i have stop updating my GUI controls in Thread.
And Updating my GUI Controls using emit signalsBut still i am facing this problem..
-
Hiii
As you say i was change my code
i have stop updating my GUI controls in Thread.
And Updating my GUI Controls using emit signalsBut still i am facing this problem..
@Ketan__Patel__0011 Can you explain exact problem you have now? The thread is a bit old already.
-
@Ketan__Patel__0011 Can you explain exact problem you have now? The thread is a bit old already.
my exact problem is some time i am lost my widgets stylesheets.
this problem is not continuously generating and i can't find exact sequence for it. -
my exact problem is some time i am lost my widgets stylesheets.
this problem is not continuously generating and i can't find exact sequence for it.@Ketan__Patel__0011 Then you will need to show what you are doing with stylesheets
-
@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); } -
@Ketan__Patel__0011 Then you will need to show what you are doing with stylesheets
Here i am using
QApplication::processEvents(); QApplication::sendPostedEvents(); this->update(); this->show();is it right ?
-
Here i am using
QApplication::processEvents(); QApplication::sendPostedEvents(); this->update(); this->show();is it right ?
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? -
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?Thanks for reply
i am trying to update widgets stylesheet.
or i am not load stylesheet from file it just lnline string. -
Thanks for reply
but i was figured out problem and solve it.
Problem was what that i was updating my UI control in thread which is wrong. -
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.
-
@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...