Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Regarding Stylesheet

    General and Desktop
    3
    6
    1322
    Loading More Posts
    • 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 V
      Venkatesh V last edited by

      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-worx 1 Reply Last reply Reply Quote 0
      • raven-worx
        raven-worx Moderators @Venkatesh V last edited by

        @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 Reply Quote 4
        • C
          Carmoneer last edited by Carmoneer

          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 Reply Quote 2
          • Venkatesh V
            Venkatesh V last edited by

            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-worx 1 Reply Last reply Reply Quote 1
            • raven-worx
              raven-worx Moderators @Venkatesh V last edited by raven-worx

              @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 Reply Quote 1
              • Venkatesh V
                Venkatesh V last edited by

                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 Reply Quote 1
                • First post
                  Last post