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. [SOLVED]adding width to a rectangle when mousearea is clicked
QtWS25 Last Chance

[SOLVED]adding width to a rectangle when mousearea is clicked

Scheduled Pinned Locked Moved QML and Qt Quick
4 Posts 3 Posters 1.7k 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.
  • J Offline
    J Offline
    jr_jags
    wrote on last edited by
    #1

    i want to add width to my rectangle when mousearea is clicked, after clicking the mousarea it stops adding, I use this rectangle as a progressbar
    How can i solve this?

    this is my code
    @ Rectangle {
    id: rectangle1
    x: 121
    y: 222
    width: 50
    height: 21
    color: "#8b4646"
    }
    MouseArea {
    id: ahome2feed
    x: 40
    y: 76
    width: 99
    height: 46
    opacity: 1
    onClicked:{
    rectangle1.width = ((50)+25)
    rectangle1.color = "#8b6746";
    }
    @

    1 Reply Last reply
    0
    • D Offline
      D Offline
      DenisKormalev
      wrote on last edited by
      #2

      Change your line 17 with
      @
      rectangle1.width = (rectangle1.width+25)
      @

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

        If it's of any use, there's already a "ProgressBar element":http://doc.qt.nokia.com/qt-components-symbian-1.0/qml-progressbar.html available in Qt Components.

        Software Engineer
        My views and opinions do not necessarily reflect those of anyone -- living or dead, real or fictional -- in this universe or any other similar multiverse node. Void where prohibited. Your mileage may vary. Caveat emptor.

        1 Reply Last reply
        0
        • J Offline
          J Offline
          jr_jags
          wrote on last edited by
          #4

          thank you very much guys ^^

          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