Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. custom button loses radius on hover

custom button loses radius on hover

Scheduled Pinned Locked Moved Solved QML and Qt Quick
4 Posts 2 Posters 401 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.
  • mzimmersM Offline
    mzimmersM Offline
    mzimmers
    wrote on last edited by
    #1

    Hi all -

    I'm trying to customize a button per the instructions here:

    Button {
       id: control
       text: qsTr("Button")
    
       contentItem: Text {
           text: control.text
           font: control.font
           opacity: enabled ? 1.0 : 0.3
           color: control.down ? "#17a81a" : "#21be2b"
           horizontalAlignment: Text.AlignHCenter
           verticalAlignment: Text.AlignVCenter
           elide: Text.ElideRight
       }
    
       background: Rectangle {
           implicitWidth: 100
           implicitHeight: 40
           opacity: enabled ? 1 : 0.3
           border.color: control.down ? "#17a81a" : "#21be2b"
           border.width: 1
           radius: 2
       }
    }
    

    Unfortunately, I want a rounder button, so I changed radius to height / 2. Looks fine until I hover over it, then it reverts. Can anything be done about this?

    Thanks...

    1 Reply Last reply
    0
    • Chris KawaC Offline
      Chris KawaC Offline
      Chris Kawa
      Lifetime Qt Champion
      wrote on last edited by
      #2

      There's a RoundButton that has a radius property.

      1 Reply Last reply
      1
      • mzimmersM Offline
        mzimmersM Offline
        mzimmers
        wrote on last edited by
        #3

        Perfect...I was aware of that one, but I didn't realize it didn't have to be truly "round" (as in circular).

        Thanks, Chris.

        1 Reply Last reply
        0
        • Chris KawaC Offline
          Chris KawaC Offline
          Chris Kawa
          Lifetime Qt Champion
          wrote on last edited by
          #4

          Yeah, RoundedButton would probably be a better name.

          1 Reply Last reply
          0

          • Login

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