QGraphicsView *graphicsView = new QGraphicsView(this); QGraphicsScene * scene = new QGraphicsScene; graphicsView->setScene(scene);scene->addRect(0,0,100,100,QPen(Qt::red,3,Qt::DashDotDotLine));
QGraphicsView *graphicsView = new QGraphicsView(this); QGraphicsScene * scene = new QGraphicsScene; QBrush brash = QBrush(Qt::lightGray,Qt::SolidPattern); QPen pen = QPen(Qt::black, 1, Qt::SolidLine, Qt::FlatCap, Qt::RoundJoin); graphicsView->setScene(scene); scene->addRect(0,0,100,100,pen,brash);
C++ (Qt)QGraphicsTextItem * QGraphicsScene::addText ( const QString & text, const QFont & font = QFont() )void QGraphicsItem::setPos ( const QPointF & pos )void QGraphicsTextItem::setDefaultTextColor ( const QColor & col )
scene->addText(QString::number(ti),serifFont); QGraphicsItem::setPos (100,100); QGraphicsTextItem::setDefaultTextColor (Qt::gray );
C++ (Qt)scene->addText(QString::number(ti),serifFont);scene->setPos (100,100);scene->setDefaultTextColor (Qt::gray );