2022-02-10 07:20:56 +08:00

43 lines
1.1 KiB
C++

#include "NameCreater.h"
#include <QtWidgets/QApplication>
#include "QGraphicsScene"
#include "QGraphicsView"
#include "QGraphicsPixmapItem"
#include "QGraphicsTextItem"
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
NameCreater w;
w.show();
QGraphicsScene scene;
scene.addText("Hello, world!");
QGraphicsView view(&scene);
QImage image(":/NameCreater/resource/background_sample.jpg");
QGraphicsPixmapItem* bgItem = new QGraphicsPixmapItem(QPixmap::fromImage(image));
scene.addItem(bgItem);
QGraphicsTextItem* textItem = new QGraphicsTextItem(QStringLiteral("\n\n"));
textItem->setFont(QFont(QStringLiteral("華康圓體 Std W8"),76));
textItem->setDefaultTextColor(QColor(255,0,0));
textItem->setPos(235, 400);
scene.addItem(textItem);
QGraphicsTextItem* textItem1 = new QGraphicsTextItem(QStringLiteral("\n\n"));
textItem1->setFont(QFont(QStringLiteral("華康圓體 Std W8")));
textItem1->setTransform(QTransform::fromScale(1, -1));
scene.addItem(textItem1);
view.show();
return a.exec();
}