當前位置:編程學習大全網 - 電腦編程 - QT在鼠標點擊後繪圖怎麽實現

QT在鼠標點擊後繪圖怎麽實現

void MainWindow::mousePressEvent(QMouseEvent *event)

{

if(event->button() == Qt::LeftButton)

{

point1->setX(event->x());

point1->setY(event->y());

this->repaint();

}

}

void MainWindow::paintEvent(QPaintEvent *)

{

QPainter painter(this);

painter.drawEllipse(point1->x(),point1->y(),15,15);

}

代碼寫的渣 不要見怪

  • 上一篇:Python 如何實現單鏈表按照奇偶位置拆分成兩個鏈表
  • 下一篇:怎麽在不銹剛法蘭上加工邊孔鉆孔和錐絲12只m20深40
  • copyright 2024編程學習大全網