Qt Drawing 2d grid based maze
-
I need a little bit of advice. I work on a school project where robot goes through grid based maze (5x5) and then he sends coordinates of individual squares and obstacles in the squares to the database from which I read them and then I need to draw map of the maze. So my question is, what is the simplest way to make the grid. I thought the easy way would be to just draw 25 rectangles but I don't know if its possible to adjust the thickness of only one side of the rectangle.
-
@thalorn
alight in that case, you have a couple of options.The simplest one would be to subclass a QWidget and override the paintEvent and simply draw your maze there.
It's easily done, but not the fastest one (in processing and painting the data)
You can go a bit further and use a QGraphicsView/Scene und do your drawing there.
And there's also QOpenGlWidget, but that's most likely overkill for your situation.
For an example,
take this stack overflow threadhttps://stackoverflow.com/questions/28912863/developing-a-maze-generator-without-opengl-in-qt-c
it has nice working examples on how to do it