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. Restore Rectangle color
Forum Updated to NodeBB v4.3 + New Features

Restore Rectangle color

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
2 Posts 2 Posters 406 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.
  • T Offline
    T Offline
    Trian
    wrote on last edited by
    #1
    This post is deleted!
    1 Reply Last reply
    0
    • A Offline
      A Offline
      ambershark
      wrote on last edited by
      #2

      I'd just use an extra color variable to control the "normal color" of the rectangle. That way it is saved automatically... Code would look like this:

      Rectangle {
         property bool alert: false
         normalColor: "black"
         color: alert ? "red" : normalColor
         Text { text: "hello" }
      }
      

      Then you can just change normalColor as you need and it will auto update.

      My L-GPL'd C++ Logger github.com/ambershark-mike/sharklog

      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