Point clickedPoint;
MainWindow
::MainWindow(QWidget *parent
){
setupUi(this);
}
MainWindow::~MainWindow()
{
}
{
if( frame1->underMouse() && event->x() > 60){
qDebug() << "global Pos: " << event->globalPos();
qDebug() << "frame glob: " << frame1->mapFromGlobal( event->globalPos() );
clickedPoint=event->pos();
}
}
{
painter.
setRenderHint(QPainter::Antialiasing);
painter.setBrush(Qt::white);
//painter.setPen(QPen(QBrush("#575555"), 1));
painter.drawRect(10, 10, 680, 500);
}
Point clickedPoint;
MainWindow::MainWindow(QWidget *parent)
: QMainWindow(parent)
{
setupUi(this);
}
MainWindow::~MainWindow()
{
}
void MainWindow::mousePressEvent( QMouseEvent *event)
{
if( frame1->underMouse() && event->x() > 60){
qDebug() << "global Pos: " << event->globalPos();
qDebug() << "frame glob: " << frame1->mapFromGlobal( event->globalPos() );
clickedPoint=event->pos();
QWidget::mousePressEvent(event);
}
QMainWindow::mousePressEvent( event );
}
void MainWindow::paintEvent(QPaintEvent *event)
{
QPainter painter(this);
painter.setRenderHint(QPainter::Antialiasing);
painter.setBrush(Qt::white);
//painter.setPen(QPen(QBrush("#575555"), 1));
painter.drawRect(10, 10, 680, 500);
QWidget::paintEvent(event);
}
To copy to clipboard, switch view to plain text mode
first of all thanks for your respond in the forum. My code is above. What sould I add the code to draw circles where I press every time. As you say I want to keep previous circles and add new ones with clicking where I want to put them.
Bookmarks