#include <QApplication>
#include <qgraphicsview>
#include <QGraphicsScene>
#include <QGraphicsRectItem>
#include <QGraphicsPixmapItem>
#include <QString>
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
QGraphicsPixmapItem* myPix = new QGraphicsPixmapItem();
//myPix->setPixmap(QString(":/timg.jpg"));
myPix->setPixmap(QPixmap(":/timg.jpg"));
QGraphicsRectItem* myRect = new QGraphicsRectItem();
myRect->setRect(0, 0, 100, 100);
myRect->setPos(200, 600);
QGraphicsScene* scene = new QGraphicsScene();
scene->addItem(myRect);
scene->addItem(myPix);
QGraphicsView* view = new QGraphicsView(scene);
view->setFixedSize(600, 800);
view->show();
return a.exec();
}
#include <qgraphicsview>
#include <QGraphicsScene>
#include <QGraphicsRectItem>
#include <QGraphicsPixmapItem>
#include <QString>
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
QGraphicsPixmapItem* myPix = new QGraphicsPixmapItem();
//myPix->setPixmap(QString(":/timg.jpg"));
myPix->setPixmap(QPixmap(":/timg.jpg"));
QGraphicsRectItem* myRect = new QGraphicsRectItem();
myRect->setRect(0, 0, 100, 100);
myRect->setPos(200, 600);
QGraphicsScene* scene = new QGraphicsScene();
scene->addItem(myRect);
scene->addItem(myPix);
QGraphicsView* view = new QGraphicsView(scene);
view->setFixedSize(600, 800);
view->show();
return a.exec();
}