How to add many images into label



  • Hi,

    I am totally new in QT. I am developing chess game and I would like to add few pictures of pawns in my program. Right know I have added background of label but I do not know how to add many images and how to place it with proper x-y co-ordinates.

    Please take a look on this screenshot and my code:

    0_1499191849092_chessboard.png

    Very simple:

    QPixmap szachownica_grafika("D:/Users/Dominik/Desktop/dokumenty/PRYWATNE/SZKOLA/INFORMATYKA/Przedmioty/wybrane/_Zaawansowane C++/szachownica_2.jpg");
        ui->label_test_grafika->setPixmap(szachownica_grafika);
    

    How can I add another images and place it in the label?

    Thanks in advance for help.


  • Moderators

    Hi! QGraphicsView is probably what you're looking for.



  • Thank You, but could you explain me a liitle bit more?

    In the Internet there is a lot of examples of using QGraphicsView with QGraphicsScene but in my application I use QDialog object and labels and I am a bit confussed right know. Cannot find any examples how to deal with this case...

    Is this possible to add graphics without using QLabel objects?


  • Lifetime Qt Champion

    Hi and welcome to devnet,

    Did you took the time to read the introduction to that framework ?

    In the list of related classes you have QGraphicsPixmapItem



  • @SGaist

    Thank you! Right now I am just looking around yet... I will read the introduction and I will be back for sure :)


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.