Solved How to make a function, which will create new labels on mouse press?
-
So here is what I came up with:
void MainWindow::mousePressEvent(QMouseEvent *mpe) { QLabel *label = new QLabel(this); label->setText(QString("%1, %2").arg(mpe->x()).arg(mpe->y())); label->setGeometry(mpe->x(),mpe->y(),100,100); }
But of course it doesn't work and I have no idea why.
-
Hi,
You do not call show on your label object.
-
@SGaist oh, really... how dumb it is
Thank you!