OiO.lk Community platform!

Oio.lk is an excellent forum for developers, providing a wide range of resources, discussions, and support for those in the developer community. Join oio.lk today to connect with like-minded professionals, share insights, and stay updated on the latest trends and technologies in the development field.
  You need to log in or register to access the solved answers to this problem.
  • You have reached the maximum number of guest views allowed
  • Please register below to remove this limitation

how to import svg to Button in QML of QT5.12.12

  • Thread starter Thread starter YunPei Zhang
  • Start date Start date
Y

YunPei Zhang

Guest
I have imported this svg on button. However, it doesn't display exactly. Only background color is imported. How to build same button including Gradient, radius, shadow, stroke and so on?

Code:
Button {
     id: inputRisk
     width: 110
     height: 110
     background: Rectangle {
        id: inputRiskbackgroung
        implicitWidth: 110
        implicitHeight: 110
        anchors.fill: parent
        Image {
            id: inputRiskImage
            source: "qrc/Main (1).svg"
            anchors.fill: parent
        }
    }
}

This is my current code.

I updated QML code but I cant see the change of result
<p>I have imported this svg on button.
However, it doesn't display exactly.
Only background color is imported.
How to build same button including Gradient, radius, shadow, stroke and so on?</p>
<pre><code>Button {
id: inputRisk
width: 110
height: 110
background: Rectangle {
id: inputRiskbackgroung
implicitWidth: 110
implicitHeight: 110
anchors.fill: parent
Image {
id: inputRiskImage
source: "qrc/Main (1).svg"
anchors.fill: parent
}
}
}
</code></pre>
<p>This is my current code.</p>
<p>I updated QML code but I cant see the change of result</p>
 

Latest posts

Top