#include #include class MyWidget : public QGraphicsView { public: MyWidget() : QGraphicsView() { QGraphicsScene *scene = new QGraphicsScene(this); scene->setItemIndexMethod(QGraphicsScene::NoIndex); scene->setSceneRect(0, 0, 400, 400); setScene(scene); QFont font("times", 30); QGraphicsTextItem *text1 = scene->addText(QString("This is a test.")); text1->setFont(font); text1->setPos(0, 10); font.setPixelSize(99); QGraphicsTextItem *text2 = scene->addText(QString("This is a test.")); text2->setFont(font); text2->setPos(0, 100); setRenderHints(QPainter::Antialiasing | QPainter::SmoothPixmapTransform | QPainter::TextAntialiasing); setViewport(new QGLWidget(QGLFormat(QGL::SampleBuffers))); } protected: }; int main(int argc, char **argv) { QApplication a(argc, argv); MyWidget w; w.show(); return a.exec(); }