#include "NameCreater.h" #include #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(); }