Hi to everybody
I'm new of QT world so I need your help.

What is the best way to draw the grids like the ones in the image?

link: https://imgur.com/1t42YOD

In the version A: I have a single row grid composed by square or rectangular elements (each one with an ID) all of the same size. Over the row I need to put another row that counts the elements and a row with some DESC label (the element that contains the DESC label should have a size that is a multiple of the square element size).

Each row should to go on a newline in someway (max square per row or simply when dimension reach the max size of the container)

With a toggle button I should toggle the view in version B.


In the version B: I have a grid of multiple row like the version A. The number line and the desc line is present only one time in each view.

In both version:

Every square should be clickable, when I click I can:

1. modify background colour
2. associate a text to the square that is indicated with a star put into square.

Text and colour information will be stored in a database sqlite.

What kind of method is the best? A Table with cellspan? A row of QRect? Other ojbects from QT library?

Thank you