I am relatively new to QT and QML in general. I have seen examples where it is possible to change the the color of some outside object (such as text) when pressing a rectangle. However, I would like to do something related, but different.
Setup:
I want to have a grid of rectangles. Let's say 5x5 grid. All of these rectangles can be of Blue color. Size is not important.
Example:
- If I press the Rectangle at (0,0) its color should change to Red.
- If I press the Rectangle at (0,1) its color should change to Red as well.
- If a Rectangle is Red and I press it, it should revert back to Blue.
Ideally, I would also like to know which Rectangles are Red and which are Blue. Hopefully I can figure that out later on. For now, it would be really useful if someone could help me start with just changing the color. It would be very helpful to just know how to change the color of a single Rectangle when it is pressed. Thank you in advance!
onEntered
as well asonClicked
. I have not tried it though – Mark Ch