Qt Forum

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

    QML embed text inside a RadioButton

    QML and Qt Quick
    3
    3
    1075
    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.
    • R
      ruysch last edited by

      Is it possible to have a RadioButton where the text is part of the button and not as usual placed at the side of the button?

      1 Reply Last reply Reply Quote 0
      • T
        t3685 last edited by

        If you are using the RadioButton from Qt.Quick.Controls you can make your own "RadioButtonStyle":http://qt-project.org/doc/qt-5/qml-qtquick-controls-styles-radiobuttonstyle.html

        1 Reply Last reply Reply Quote 0
        • dheerendra
          dheerendra Qt Champions 2022 last edited by

          You can style RadioButton as previous post indicated. You can also develop your own radio button like the following.

          @Rectangle {
          width: 40
          height: 40
          radius: width/2
          border.color: "black"
          border.width: 2
          Rectangle {
          id :radio
          anchors.centerIn: parent
          width: parent.width-10
          height: parent.height-10
          radius: width/2
          border.width: 1
          border.color: "black"
          Text {
          anchors.centerIn: parent
          text: "Wor"
          }
          }
          MouseArea {
          anchors.fill: parent
          onClicked: {
          radio.color = "black"
          }
          }
          }@

          Dheerendra
          @Community Service
          Certified Qt Specialist
          http://www.pthinks.com

          1 Reply Last reply Reply Quote 0
          • First post
            Last post