Lost My Qt Widgets StyleSheets
-
Then you don't load them correct. But since you don't provide some source code to reproduce your problem we can't help.
-
it is simple Stylesheet Like:
QPushButton
{
background-color:rgb(241,92,34);
}i am not used any other functionality to design any control, i just apply some Stylesheet on my qt application
but whenever i run my application my application stylesheet are gone...
-
This is still no reproducible example. Create one which is compilable or we can't help - how should we know what else you're doing somewhere?
-
when i start My QFuture<void> thread And run Any function parallelly
that time this problem is raised -
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