Unsolved Update a window and create a board
I'm always struggling when having to make a UI using QWidget etc so for once I'm trying to get some help to do things properly.
The idea is:: I got a mainWindow where I select the size of my board and other parameters then click play (everything there was previously added in qt designer). On play, I hide what was previously showing and I want to display my board.
For now, I'm just trying to use a grid layout already added in qt designer and add things to it to create my board, but I can't manage to display anything out of it.
I tried adding labels, image and pixmap, widget, ... to the grid layout but never got anything out of it.
The question is:
I have my window, a grid layout added in qt designer and a play button. What should I do in my play button method to create that board?
That board will only be made of colored squares, it can be with an image or some kind of square that I can color, and I need to be able to click on those square (to act like the game flood it).
Thank you! I probably really badly explained that and I don't think there is much code worth showing cause it's basically a main window and a QPushButton event filled with failed attempts so feel free to ask me for any additional info!
You can use a QStackWidgets allowing you to have pages so first page is the size etc info and when you press ok to that you switch to the second page that has the right size board.
Its hard to tell you how to construct the board as its unclear how much interaction you need as maybe drawing it with QPainter is the most flexible or even using the
https://doc.qt.io/qt-5/graphicsview.html might be a good way if zoom/panning and such things are needed.
Its ok with no code, but maybe you could show an image of what you are aiming for , board wise ?
like this ?
@mrjj Yes something like that, the size is decided at the creation and only the color of the cell will change while playing. I'll look into what you sent but I think I'm missing something because when I open a new window or just use the same window to display my board I never manage to display anything. I tried Qpainter too. But thanks already I'll check QStackWidgets