PDA

View Full Version : Insert Picture



Johnsen
5th March 2019, 10:56
I want to insert a photo into a label on QT



QPixmap pix("C:\Users\haral\OneDrive\Documents\NY\Nyeveier.jpg");
ui->label_Pic->setPixmap(pix.scaled(100,100,Qt::KeepAspectRatio)) ;
I use this code
but get an error U used with no following hex digtis in line 1

Added after 5 minutes:


I want to insert a photo into a label on QT



QPixmap pix("C:\Users\haral\OneDrive\Documents\NY\Nyeveier.jpg");
ui->label_Pic->setPixmap(pix.scaled(100,100,Qt::KeepAspectRatio)) ;
I use this code
but get an error U used with no following hex digtis in line 1

I found a solution to the error, but image will not appear.

Ginsengelf
5th March 2019, 13:37
Hi, in C/C++ you need to escape backslashes (or use a forward slash /).

Ginsengelf