PDA

View Full Version : What the widgets I have to use to create application like on the added photo



Vadym
15th August 2017, 23:50
quntity of rectangles will change and colour will depend on temperature from sensors

12554

d_stranz
16th August 2017, 16:53
You can use QProgressBar for all of the rectangles, I think. You could also look on the inqlude (https://inqlude.org/) and linux-apps (https://www.linux-apps.com/) web sites for libraries that contain similar widgets.

Vadym
16th August 2017, 17:22
maybe not good example, my rectangle have to be full painted not level or part, change colour only

d_stranz
17th August 2017, 19:20
You can still use QProgressBar, just set the value to 100% of the range. If all you want is a plain rectangle with different background color, then you can use a QWidget and simply change the QPalette Window color role to the color you want.

If you don't want something like the picture you posted, then what *do* you want? Why post a picture of something that is different from what you want, and then ask us how to make something that looks like the picture? You waste our time.

Vadym
22nd August 2017, 10:35
I have an idea to use scrolArea then insert QWidgets and in every QWidget paint (using QPainter) rectangle or polygon even .
but I do not know how to write code to paint figure in separate QWidget.....will be good it or not ? sorry for maybe stupid questions but I new in qt, sthanks

d_stranz
22nd August 2017, 20:21
Your Qt distribution comes with a huge set of example programs, including many on painting widgets (https://doc.qt.io/qt-5/examples-painting.html). Why don't you study those and understand how it works before trying to do something yourself?