'How to create a gamefield in qt with C++

Hello im new to qt (C++) and i try to programm the Game Dame. My Problem is now that i dont know how to make the gamefield (same as chess gamefield) where i can put the game figures on and show possible movements when you click on a figure. I know that i can create an array by this way in C++:

int x, y;
int array[8][8];

for(y=0; y<8; y++)
{
    for(x=0; x<8; x++)
    {
        cout<<array[y][x];
    }
    cout<<endl;
}

Does anybody has an idea? I dont know which way is better (create an array or put in .png pictures and a button behind.



Solution 1:[1]

The QGraphicsScene is a very nice class that can be used to display sprites on a background.

Good overview here also : https://doc.qt.io/qt-5/graphicsview.html

It may be also possible to get click events to manage user interaction with the mouse.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Yoruk