Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Lost My Qt Widgets StyleSheets
Forum Updated to NodeBB v4.3 + New Features

Lost My Qt Widgets StyleSheets

Scheduled Pinned Locked Moved Solved General and Desktop
25 Posts 6 Posters 4.7k Views 2 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • jsulmJ jsulm

    @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__0011K Offline
    Ketan__Patel__0011K Offline
    Ketan__Patel__0011
    wrote on last edited by
    #11

    @jsulm

    is it possible to run one or more function parallel in GUI thread ?

    JonBJ jsulmJ 2 Replies Last reply
    0
    • Ketan__Patel__0011K Ketan__Patel__0011

      @jsulm

      is it possible to run one or more function parallel in GUI thread ?

      JonBJ Offline
      JonBJ Offline
      JonB
      wrote on last edited by JonB
      #12

      @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.

      1 Reply Last reply
      0
      • Ketan__Patel__0011K Ketan__Patel__0011

        @jsulm

        is it possible to run one or more function parallel in GUI thread ?

        jsulmJ Offline
        jsulmJ Offline
        jsulm
        Lifetime Qt Champion
        wrote on last edited by
        #13

        @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...

        https://forum.qt.io/topic/113070/qt-code-of-conduct

        Ketan__Patel__0011K 1 Reply Last reply
        1
        • jsulmJ jsulm

          @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__0011K Offline
          Ketan__Patel__0011K Offline
          Ketan__Patel__0011
          wrote on last edited by
          #14

          @jsulm

          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 signals

          But still i am facing this problem..

          jsulmJ 1 Reply Last reply
          0
          • Ketan__Patel__0011K Ketan__Patel__0011

            @jsulm

            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 signals

            But still i am facing this problem..

            jsulmJ Offline
            jsulmJ Offline
            jsulm
            Lifetime Qt Champion
            wrote on last edited by
            #15

            @Ketan__Patel__0011 Can you explain exact problem you have now? The thread is a bit old already.

            https://forum.qt.io/topic/113070/qt-code-of-conduct

            Ketan__Patel__0011K 1 Reply Last reply
            0
            • jsulmJ jsulm

              @Ketan__Patel__0011 Can you explain exact problem you have now? The thread is a bit old already.

              Ketan__Patel__0011K Offline
              Ketan__Patel__0011K Offline
              Ketan__Patel__0011
              wrote on last edited by Ketan__Patel__0011
              #16

              @jsulm

              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.

              jsulmJ 1 Reply Last reply
              0
              • Ketan__Patel__0011K Ketan__Patel__0011

                @jsulm

                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.

                jsulmJ Offline
                jsulmJ Offline
                jsulm
                Lifetime Qt Champion
                wrote on last edited by
                #17

                @Ketan__Patel__0011 Then you will need to show what you are doing with stylesheets

                https://forum.qt.io/topic/113070/qt-code-of-conduct

                Ketan__Patel__0011K 2 Replies Last reply
                0
                • jsulmJ jsulm

                  @Ketan__Patel__0011 Then you will need to show what you are doing with stylesheets

                  Ketan__Patel__0011K Offline
                  Ketan__Patel__0011K Offline
                  Ketan__Patel__0011
                  wrote on last edited by
                  #18

                  @jsulm

                  I am just changing my buttons or other controls stylesheet based of some condition..
                  like

                  if(IS_ Button_1_Clicked == true)
                  {
                         ui->pushbutton_1->setStyleSheet(MY_FIRST_STYLE);
                  }
                  else
                  {
                         ui->pushbutton_1->setStyleSheet(MY_SECOND_STYLE);
                  }
                  
                  1 Reply Last reply
                  0
                  • jsulmJ jsulm

                    @Ketan__Patel__0011 Then you will need to show what you are doing with stylesheets

                    Ketan__Patel__0011K Offline
                    Ketan__Patel__0011K Offline
                    Ketan__Patel__0011
                    wrote on last edited by
                    #19

                    @jsulm

                    Here i am using

                       QApplication::processEvents();
                       QApplication::sendPostedEvents();
                       this->update();
                       this->show();
                    

                    is it right ?

                    mrjjM 1 Reply Last reply
                    0
                    • Ketan__Patel__0011K Ketan__Patel__0011

                      @jsulm

                      Here i am using

                         QApplication::processEvents();
                         QApplication::sendPostedEvents();
                         this->update();
                         this->show();
                      

                      is it right ?

                      mrjjM Offline
                      mrjjM Offline
                      mrjj
                      Lifetime Qt Champion
                      wrote on last edited by
                      #20

                      @Ketan__Patel__0011

                      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?

                      Ketan__Patel__0011K 1 Reply Last reply
                      0
                      • mrjjM mrjj

                        @Ketan__Patel__0011

                        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?

                        Ketan__Patel__0011K Offline
                        Ketan__Patel__0011K Offline
                        Ketan__Patel__0011
                        wrote on last edited by Ketan__Patel__0011
                        #21

                        @mrjj

                        Thanks for reply

                        i am trying to update widgets stylesheet.
                        or i am not load stylesheet from file it just lnline string.

                        1 Reply Last reply
                        0
                        • H Offline
                          H Offline
                          Hardy91
                          wrote on last edited by
                          #22

                          A similar question posted here

                          Ketan__Patel__0011K 1 Reply Last reply
                          0
                          • H Hardy91

                            A similar question posted here

                            Ketan__Patel__0011K Offline
                            Ketan__Patel__0011K Offline
                            Ketan__Patel__0011
                            wrote on last edited by
                            #23

                            @Hardy91

                            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.

                            1 Reply Last reply
                            0
                            • Ketan__Patel__0011K Ketan__Patel__0011 has marked this topic as solved on
                            • H Offline
                              H Offline
                              Hardy91
                              wrote on last edited by
                              #24

                              @Ketan__Patel__0011 : how you find out where is the issue? any debug strategy you used, that would be helpful.

                              Christian EhrlicherC 1 Reply Last reply
                              0
                              • H Hardy91

                                @Ketan__Patel__0011 : how you find out where is the issue? any debug strategy you used, that would be helpful.

                                Christian EhrlicherC Online
                                Christian EhrlicherC Online
                                Christian Ehrlicher
                                Lifetime Qt Champion
                                wrote on last edited by
                                #25

                                @Hardy91 Simply don't modify ui elements from outside the main (ui) thread...

                                Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
                                Visit the Qt Academy at https://academy.qt.io/catalog

                                1 Reply Last reply
                                2

                                • Login

                                • Login or register to search.
                                • First post
                                  Last post
                                0
                                • Categories
                                • Recent
                                • Tags
                                • Popular
                                • Users
                                • Groups
                                • Search
                                • Get Qt Extensions
                                • Unsolved