View Full Version : How to check if QLabel is empty??
ganapathi
3rd December 2015, 15:19
Hi,
I have a gridlayout and in it are 9 QLabels where I emit QImages and display them.
I have to check if QLabel is free and them emit QImage so it is displayed.
How do I check if QLabel is already used by somebody so I can go to other QLabel.
this is very helpful in doing dynamic Layouts.
Regards
Vikram.Saralaya
3rd December 2015, 16:04
QLabel:: pixmap() returns 0 if no pixmap is set on it.
ganapathi
4th December 2015, 05:39
Hi Vikram
Many signals are mapped to One slot . In slot function, I decide the empty label like this:
if(ui->label->pixmap == 0)
ui->label->setPixMap(......image 1..);
else if (if(ui->label_2->pixmap == 0)
ui->label_2->setPixMap(...... image 2..);
Both the images are displayed on first label only. ie ui->label.
I want the second image to be displayed on the ui->label_2.
I don't display the whole Image on label at once. I display them strip by strip ie blocks of 20*768 size strips.
Any idea?
Thanks for the reply.
Vikram.Saralaya
4th December 2015, 10:41
It should be label->pixmap(). Without parenthesis you are checking the function pointer which isn't 0.
anda_skoa
4th December 2015, 15:47
And you probably want to check isNull() on the returned pixmap.
Cheers,
_
ganapathi
9th December 2015, 04:47
It should be label->pixmap(). Without parenthesis you are checking the function pointer which isn't 0.
Thanks vikram....it worked.
Powered by vBulletin® Version 4.2.5 Copyright © 2024 vBulletin Solutions Inc. All rights reserved.