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. Why all styles are not applied to promoted widget ??
Forum Updated to NodeBB v4.3 + New Features

Why all styles are not applied to promoted widget ??

Scheduled Pinned Locked Moved Solved General and Desktop
7 Posts 3 Posters 870 Views 1 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.
  • Thank YouT Offline
    Thank YouT Offline
    Thank You
    wrote on last edited by
    #1

    I have some ui files. I have promoted "forum.h" in mainWindows.h. The portion of forum.h doesn't contain all stylesheets which are actually in it.

    Like
    forum.ui has border-image:url(:/Resources/images/background.jpg);
    , also it has widget with color of rgba(20,30,10,0.5);
    and it has another label with border-image:url(:/Resources/images/logo.png);

    These all things are shown in forum.ui in Qt Creator
    BUT,
    in promoted widget the background of label is working and others are not working
    Does Qt support Jpg file or What is the reason behind it??

    Let's make QT free or It will go forever

    TRUE AND FALSE <3

    jsulmJ 1 Reply Last reply
    0
    • Thank YouT Thank You

      @jsulm I have generated these files using QT Creator. I used drag and drop method to build ui. I have promoted widgets to another using the same method.

      I created new ui form using Designer Form Class using CTRL + N

      Either I didn't understand what are you saying
      Or You did not understand my Question.

      The main problem is all of stylesheets are not working. Only some stylesheets are working.

      i hope you understand this Question @jsulm

      Thank YouT Offline
      Thank YouT Offline
      Thank You
      wrote on last edited by
      #4

      I got the right answers.

      Here are some points to be considered while applying stylesheets in QT

      1. If you know css then
        rgb(10,20,30,0.8) works but in QT it doesn't
        use rgba(10,20,30,0.8) instead.
        Never apply major style sheets like border image in widget name (Suppose the file name is "login.ui" don't apply style sheets in login object)

      It may or may not work for all files.
      But it worked for me.

      Thank You

      Let's make QT free or It will go forever

      TRUE AND FALSE <3

      Pl45m4P 1 Reply Last reply
      0
      • Thank YouT Thank You

        I have some ui files. I have promoted "forum.h" in mainWindows.h. The portion of forum.h doesn't contain all stylesheets which are actually in it.

        Like
        forum.ui has border-image:url(:/Resources/images/background.jpg);
        , also it has widget with color of rgba(20,30,10,0.5);
        and it has another label with border-image:url(:/Resources/images/logo.png);

        These all things are shown in forum.ui in Qt Creator
        BUT,
        in promoted widget the background of label is working and others are not working
        Does Qt support Jpg file or What is the reason behind it??

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

        @Thank-You Take a look at generated ui_forum.h (build first your project).
        See https://doc.qt.io/qt-5/designer-using-a-ui-file.html

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

        Thank YouT 1 Reply Last reply
        1
        • jsulmJ jsulm

          @Thank-You Take a look at generated ui_forum.h (build first your project).
          See https://doc.qt.io/qt-5/designer-using-a-ui-file.html

          Thank YouT Offline
          Thank YouT Offline
          Thank You
          wrote on last edited by
          #3

          @jsulm I have generated these files using QT Creator. I used drag and drop method to build ui. I have promoted widgets to another using the same method.

          I created new ui form using Designer Form Class using CTRL + N

          Either I didn't understand what are you saying
          Or You did not understand my Question.

          The main problem is all of stylesheets are not working. Only some stylesheets are working.

          i hope you understand this Question @jsulm

          Let's make QT free or It will go forever

          TRUE AND FALSE <3

          Thank YouT 1 Reply Last reply
          0
          • Thank YouT Thank You

            @jsulm I have generated these files using QT Creator. I used drag and drop method to build ui. I have promoted widgets to another using the same method.

            I created new ui form using Designer Form Class using CTRL + N

            Either I didn't understand what are you saying
            Or You did not understand my Question.

            The main problem is all of stylesheets are not working. Only some stylesheets are working.

            i hope you understand this Question @jsulm

            Thank YouT Offline
            Thank YouT Offline
            Thank You
            wrote on last edited by
            #4

            I got the right answers.

            Here are some points to be considered while applying stylesheets in QT

            1. If you know css then
              rgb(10,20,30,0.8) works but in QT it doesn't
              use rgba(10,20,30,0.8) instead.
              Never apply major style sheets like border image in widget name (Suppose the file name is "login.ui" don't apply style sheets in login object)

            It may or may not work for all files.
            But it worked for me.

            Thank You

            Let's make QT free or It will go forever

            TRUE AND FALSE <3

            Pl45m4P 1 Reply Last reply
            0
            • Thank YouT Thank You

              I got the right answers.

              Here are some points to be considered while applying stylesheets in QT

              1. If you know css then
                rgb(10,20,30,0.8) works but in QT it doesn't
                use rgba(10,20,30,0.8) instead.
                Never apply major style sheets like border image in widget name (Suppose the file name is "login.ui" don't apply style sheets in login object)

              It may or may not work for all files.
              But it worked for me.

              Thank You

              Pl45m4P Offline
              Pl45m4P Offline
              Pl45m4
              wrote on last edited by
              #5

              @Thank-You

              You wrote rgba(x,x,x,x) in your inital post... Still dont know what the issue was about, but if it's working now, it's fine :)

              Qt Stylesheet can use rgb(r,g,b) as well as rgba(r,g,b,a) with additional alpha value. Of course you can't pass 4 values to rgb().

              https://doc.qt.io/qt-5/stylesheet-reference.html#list-of-property-types


              If debugging is the process of removing software bugs, then programming must be the process of putting them in.

              ~E. W. Dijkstra

              Thank YouT 1 Reply Last reply
              1
              • Pl45m4P Pl45m4

                @Thank-You

                You wrote rgba(x,x,x,x) in your inital post... Still dont know what the issue was about, but if it's working now, it's fine :)

                Qt Stylesheet can use rgb(r,g,b) as well as rgba(r,g,b,a) with additional alpha value. Of course you can't pass 4 values to rgb().

                https://doc.qt.io/qt-5/stylesheet-reference.html#list-of-property-types

                Thank YouT Offline
                Thank YouT Offline
                Thank You
                wrote on last edited by
                #6

                @Pl45m4 Sorry rgba() was mistake in initial post.
                But we can use 4 values in rgb() like rgb(x,x,x,x) in CSS
                So I mean to say that if you have to use alpha value then use rgba() instead of just rgb()
                Thank You

                Let's make QT free or It will go forever

                TRUE AND FALSE <3

                Pl45m4P 1 Reply Last reply
                0
                • Thank YouT Thank You

                  @Pl45m4 Sorry rgba() was mistake in initial post.
                  But we can use 4 values in rgb() like rgb(x,x,x,x) in CSS
                  So I mean to say that if you have to use alpha value then use rgba() instead of just rgb()
                  Thank You

                  Pl45m4P Offline
                  Pl45m4P Offline
                  Pl45m4
                  wrote on last edited by
                  #7

                  @Thank-You

                  It's just the naming of the function. Since Qt has an extra function for alpha values, rgb is for r, g, b only.
                  If you know it, there is nothing special about it. And one can read the documention, to see how it works:)


                  If debugging is the process of removing software bugs, then programming must be the process of putting them in.

                  ~E. W. Dijkstra

                  1 Reply Last reply
                  1

                  • Login

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