1 | initial version |
To show an image in your Qt project, you can use the QLabel widget and set its pixmap to your image. Here's an example:
#include <QLabel>
QLabel *imageLabel = new QLabel(this);
imageLabel->setPixmap(QPixmap(":/path/to/image.png"));
Note that the image file path is specified as a Qt resource file path using the "qrc" protocol. You can add the image file to your Qt resource file by right-clicking on the file in the "Project" view and selecting "Add New... -> Qt -> Qt Resource File".
imageLabel->setGeometry(10, 10, 100, 100);
This example sets the position of the widget to (10, 10) and the size to 100x100 pixels.
imageLabel->show();
This will display the image in your Qt project.