Click here to Skip to main content
13,830,588 members
Rate this:
 
Please Sign up or sign in to vote.
See more:
I have problem with assigning image to a label.I have tried below but it is not displaying anything.Please provide me solution


QPixmap pixmap(":/mnt/jffs2/VMS_orglogo.png");
ui->label_25->setPixmap(pixmap);
ui->label_25->setMask(pixmap.mask());
ui->label_25->show();

What I have tried:

QPixmap pixmap(":/mnt/jffs2/VMS_orglogo.png");
ui->label_25->setPixmap(pixmap);
ui->label_25->setMask(pixmap.mask());
ui->label_25->show();
Posted
Updated 16-Apr-18 5:08am

1 solution

Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 1

Remove the setMask() call and ensure that the file has been loaded (exists). The latter can be done by checking for pixmap->isNull() being false.
   

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


Advertise | Privacy | Cookies | Terms of Service
Web01 | 2.8.190114.1 | Last Updated 16 Apr 2018
Copyright © CodeProject, 1999-2019
All Rights Reserved.
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100