Solved QMessageBox.setIconPixmap(QLabel.pixmap()) ?
-
reference to type 'const QPixmap' could not bind to an lvalue of type 'const QPixmap *'
QMessageBox MB(QMessageBox::NoIcon, "Result", "Player1 win !"); const QPixmap *pixmap = ui->label_avatar1->pixmap(); MB.setIconPixmap(pixmap); MB.exec();
-
QMessageBox::setIconPixmap()
takesconst QPixmap &
, notconst QPixmap *
-
@JKSH
error: reference to type 'const QPixmap' could not bind to an rvalue of type 'const QPixmap *'const QPixmap &pixmap = ui->label_avatar1->pixmap();
-
@sonichy said in QMessageBox.setIconPixmap(QLabel.pixmap()) ?:
@JKSH
error: reference to type 'const QPixmap' could not bind to an rvalue of type 'const QPixmap *'const QPixmap &pixmap = ui->label_avatar1->pixmap();
QLabel::pixmap()
returnsconst Pixmap *
, notconst Pixmap &
Do you know how to use pointers and references?
-
@JKSH Solved !
QMessageBox MB(QMessageBox::NoIcon, "Result", "Player1 win !"); const QPixmap *pixmap = ui->label_avatar1->pixmap(); MB.setIconPixmap(*pixmap); MB.exec();
-
@sonichy said in QMessageBox.setIconPixmap(QLabel.pixmap()) ?:
Solved !
👍
Please mark as solved (Click "Topic Tools" on the top-right or bottom-right of this page)