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. Regarding Stylesheet
Qt 6.11 is out! See what's new in the release blog

Regarding Stylesheet

Scheduled Pinned Locked Moved General and Desktop
6 Posts 3 Posters 2.3k 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.
  • Venkatesh VV Offline
    Venkatesh VV Offline
    Venkatesh V
    wrote on last edited by
    #1

    Hi...
    I am implementing customized radiobutton, there i am setting stylesheet to radiobutton like this,
    setStyleSheet("QRadioButton::indicator::hover {width: 30px;height: 30px;};");

    this works fine when i hover on button but along with this i need to set one more style that is i need to increase size of button when button not hovered.. for this how can i set?

    Thanks.

    raven-worxR 1 Reply Last reply
    0
    • Venkatesh VV Venkatesh V

      Hi...
      I am implementing customized radiobutton, there i am setting stylesheet to radiobutton like this,
      setStyleSheet("QRadioButton::indicator::hover {width: 30px;height: 30px;};");

      this works fine when i hover on button but along with this i need to set one more style that is i need to increase size of button when button not hovered.. for this how can i set?

      Thanks.

      raven-worxR Offline
      raven-worxR Offline
      raven-worx
      Moderators
      wrote on last edited by
      #2

      @Venkatesh-V

      radioButton->setStyleSheet(
      "QRadioButton::indicator {width: 32px;height: 32px;};"
      "QRadioButton::indicator:hover {width: 30px;height: 30px;};"
      );
      

      --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
      If you have a question please use the forum so others can benefit from the solution in the future

      1 Reply Last reply
      4
      • C Offline
        C Offline
        Carmoneer
        wrote on last edited by Carmoneer
        #3

        Here is the Qt stylesheet guide. You can find additional options for the radio button, but if I understand you correctly this is what you're asking for:

        setStyleSheet("QRadioButton::indicator:hover { width: 30px; height: 30px;}; QRadioButton::indicator { width: 15px; height: 15px; };");
        

        Just concatenate the next style in the same stylesheet string.

        Edit: Fixed scope resolution operators.

        1 Reply Last reply
        2
        • Venkatesh VV Offline
          Venkatesh VV Offline
          Venkatesh V
          wrote on last edited by
          #4

          Thanks @raven-worx ...
          thanks @Carmoneer ...

          i have tried this... but i'm not getting both properties.. only first one i got.... if i give hover property first and then another hover only comes... what can i do for this...

          Thanks.

          raven-worxR 1 Reply Last reply
          1
          • Venkatesh VV Venkatesh V

            Thanks @raven-worx ...
            thanks @Carmoneer ...

            i have tried this... but i'm not getting both properties.. only first one i got.... if i give hover property first and then another hover only comes... what can i do for this...

            Thanks.

            raven-worxR Offline
            raven-worxR Offline
            raven-worx
            Moderators
            wrote on last edited by raven-worx
            #5

            @Venkatesh-V said in Regarding Stylesheet:

            i have tried this... but i'm not getting both properties.. only first one i got.... if i give hover property first and then another hover only comes... what can i do for this...

            sorry, but i don't understand what you wrote.

            --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
            If you have a question please use the forum so others can benefit from the solution in the future

            1 Reply Last reply
            1
            • Venkatesh VV Offline
              Venkatesh VV Offline
              Venkatesh V
              wrote on last edited by
              #6

              Hi @raven-worx

              my .cpp file like this bellow

              MyRadioButton::MyRadioButton(QString RadioButtonText, QWidget *parent) : QRadioButton(RadioButtonText,parent)
              {
              this->setStyleSheet("QRadioButton::indicator:hover { width: 30px; height: 30px;}; QRadioButton::indicator { width: 25px; height: 25px; };");

              }

              for this i am able to changing my radiobutton size when i hover on it.. before hover on it the size is remains default size.. i need that size as 25px... only first style works here.. not second one.

              Thanks.

              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