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. How to draw "WiFi icon" using QML
Forum Updated to NodeBB v4.3 + New Features

How to draw "WiFi icon" using QML

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
6 Posts 3 Posters 926 Views
  • 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.
  • M Offline
    M Offline
    Muktha PM
    wrote on last edited by
    #1

    WiFi icon needs to be drawn in QML

    1 Reply Last reply
    0
    • MarkkyboyM Offline
      MarkkyboyM Offline
      Markkyboy
      wrote on last edited by
      #2

      Why must it be drawn?, for what purpose?, what are you trying to achieve?

      Why can you not simply use an existing icon in jpg/png/svg format?

      Don't just sit there standing around, pick up a shovel and sweep up!

      I live by the sea, not in it.

      M 1 Reply Last reply
      0
      • ndiasN Offline
        ndiasN Offline
        ndias
        wrote on last edited by
        #3

        Hi @Muktha-PM,

        As @Markkyboy metioned before you can use a svg or png format to draw a WiFi icon. If you want draw it you can use shapepath to do it.

        You can find an simple draft below:

        import QtQuick
        import QtQuick.Shapes
        
        Item {
            id: wifiIcon
        
            width: parent.width < parent.height ? parent.width : parent.height
            height: width
            anchors.centerIn: parent
        
            Rectangle {
                anchors.horizontalCenter: wifiIcon.horizontalCenter
                anchors.bottom: wifiIcon.bottom
                
        
                // Set size and corner radius to define a circle
                width: wifiIcon.width/6
                height: wifiIcon.height/6
                radius: width/2
                
                color: "#4EC5F1"
                //border.color: "black"
                //border.width: 1
            }
        
            Shape {
                ShapePath {
                    fillColor: "transparent"
                    strokeColor: "#4EC5F1"
                    strokeWidth: wifiIcon.height/8
                    capStyle: ShapePath.RoundCap
                    PathAngleArc {
                        centerX: wifiIcon.height / 2
                        centerY: wifiIcon.width / 4 + wifiIcon.width / 4
                        radiusX: wifiIcon.width < wifiIcon.height ? wifiIcon.width/2 - wifiIcon.height/8 : wifiIcon.height/2 - wifiIcon.height/8
                        radiusY: radiusX
                        startAngle: 200
                        sweepAngle: 140
                    }
                }
        
                ShapePath {
                    fillColor: "transparent"
                    strokeColor: "#4EC5F1"
                    strokeWidth: wifiIcon.height/8
                    capStyle: ShapePath.RoundCap
                    PathAngleArc {
                        centerX: wifiIcon.height / 2
                        centerY: wifiIcon.width / 3 + wifiIcon.width / 4
                        radiusX: wifiIcon.width < wifiIcon.height ? wifiIcon.width/3 - wifiIcon.height/8 : wifiIcon.height/3 - wifiIcon.height/8
                        radiusY: radiusX
                        startAngle: 200
                        sweepAngle: 140
                    }
                }
        
                ShapePath {
                    fillColor: "transparent"
                    strokeColor: "#4EC5F1"
                    strokeWidth: wifiIcon.height/8
                    capStyle: ShapePath.RoundCap
                    PathAngleArc {
                        centerX: wifiIcon.height / 2
                        centerY: wifiIcon.width / 2 + wifiIcon.width / 4
                        radiusX: wifiIcon.width < wifiIcon.height ? wifiIcon.width/4 - wifiIcon.height/8 : wifiIcon.height/4 - wifiIcon.height/8
                        radiusY: radiusX
                        startAngle: 200
                        sweepAngle: 140
                    }
                }
            }
        }
        

        Regards

        M 1 Reply Last reply
        0
        • MarkkyboyM Markkyboy

          Why must it be drawn?, for what purpose?, what are you trying to achieve?

          Why can you not simply use an existing icon in jpg/png/svg format?

          M Offline
          M Offline
          Muktha PM
          wrote on last edited by
          #4

          @Markkyboy To show the network strength, in jpg or with any image icons, we cannot show the network strength.

          ndiasN 1 Reply Last reply
          0
          • M Muktha PM

            @Markkyboy To show the network strength, in jpg or with any image icons, we cannot show the network strength.

            ndiasN Offline
            ndiasN Offline
            ndias
            wrote on last edited by
            #5

            @Muktha-PM said in How to draw "WiFi icon" using QML:

            @Markkyboy To show the network strength, in jpg or with any image icons, we cannot show the network strength.

            Hi @Muktha-PM ,
            You can change the image source property according to the network strength:
            cb28a74a-23c6-470e-af58-825bea828106-image.png

            1 Reply Last reply
            2
            • ndiasN ndias

              Hi @Muktha-PM,

              As @Markkyboy metioned before you can use a svg or png format to draw a WiFi icon. If you want draw it you can use shapepath to do it.

              You can find an simple draft below:

              import QtQuick
              import QtQuick.Shapes
              
              Item {
                  id: wifiIcon
              
                  width: parent.width < parent.height ? parent.width : parent.height
                  height: width
                  anchors.centerIn: parent
              
                  Rectangle {
                      anchors.horizontalCenter: wifiIcon.horizontalCenter
                      anchors.bottom: wifiIcon.bottom
                      
              
                      // Set size and corner radius to define a circle
                      width: wifiIcon.width/6
                      height: wifiIcon.height/6
                      radius: width/2
                      
                      color: "#4EC5F1"
                      //border.color: "black"
                      //border.width: 1
                  }
              
                  Shape {
                      ShapePath {
                          fillColor: "transparent"
                          strokeColor: "#4EC5F1"
                          strokeWidth: wifiIcon.height/8
                          capStyle: ShapePath.RoundCap
                          PathAngleArc {
                              centerX: wifiIcon.height / 2
                              centerY: wifiIcon.width / 4 + wifiIcon.width / 4
                              radiusX: wifiIcon.width < wifiIcon.height ? wifiIcon.width/2 - wifiIcon.height/8 : wifiIcon.height/2 - wifiIcon.height/8
                              radiusY: radiusX
                              startAngle: 200
                              sweepAngle: 140
                          }
                      }
              
                      ShapePath {
                          fillColor: "transparent"
                          strokeColor: "#4EC5F1"
                          strokeWidth: wifiIcon.height/8
                          capStyle: ShapePath.RoundCap
                          PathAngleArc {
                              centerX: wifiIcon.height / 2
                              centerY: wifiIcon.width / 3 + wifiIcon.width / 4
                              radiusX: wifiIcon.width < wifiIcon.height ? wifiIcon.width/3 - wifiIcon.height/8 : wifiIcon.height/3 - wifiIcon.height/8
                              radiusY: radiusX
                              startAngle: 200
                              sweepAngle: 140
                          }
                      }
              
                      ShapePath {
                          fillColor: "transparent"
                          strokeColor: "#4EC5F1"
                          strokeWidth: wifiIcon.height/8
                          capStyle: ShapePath.RoundCap
                          PathAngleArc {
                              centerX: wifiIcon.height / 2
                              centerY: wifiIcon.width / 2 + wifiIcon.width / 4
                              radiusX: wifiIcon.width < wifiIcon.height ? wifiIcon.width/4 - wifiIcon.height/8 : wifiIcon.height/4 - wifiIcon.height/8
                              radiusY: radiusX
                              startAngle: 200
                              sweepAngle: 140
                          }
                      }
                  }
              }
              

              Regards

              M Offline
              M Offline
              Muktha PM
              wrote on last edited by
              #6

              @ndias Thank you

              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