How do I paint with QPainter?

后端 未结 3 645
我在风中等你
我在风中等你 2021-01-05 04:23

I have started learning Qt recently.
I did not get quite clear how can I paint using QPainter class. Let`s say I want just to place a few points in the win

3条回答
  •  隐瞒了意图╮
    2021-01-05 05:00

    void SimpleExampleWidget::paintEvent(QPaintEvent *)
    {
         QPainter painter(this);
         painter.setPen(Qt::blue);
         painter.setFont(QFont("Arial", 30));
         painter.drawText(rect(), Qt::AlignCenter, "Qt");
    }
    

    http://doc.qt.digia.com/4.4/qpainter.html

提交回复
热议问题