I have a QHBox with a custom widget that inherits QLabel which iterates through all image files in a dir and generates a thumbnail.
This part is working fine, however I need to implement the functionality to display the original image from which the thumbnail was generated in a central QLabel widget for diplaying pictures.
What would be the best way of doing this? Right now the clicked() signal is only displaying the QPixmap from the QLabel(thumbnail), what I need it to do is load the original full size image on a QLabel that is at the center.
I'm guessing I will need a list of some sort to identify each thumbnail with its unique full size image, but im not sure how to implement such thing.
Please advise me on should I go about implementing this as I feel i'm a bit lost on what to do.
My code right now looks like this:
QList<ImageLabel *> labels;
int imagenum = 0;
foreach(const QString &path, files) {
QPixmap px(path);
labels.append(new ImageLabel);
labels[imagenum]->setPixmap(px.scaledToHeight(90));
qhbox->addWidget(labels[imagenum]);
connect(labels[imagenum], SIGNAL(clicked(const QPixmap&)), this, SLOT(setImage(const QPixmap &)));
imagenum++;
}
Thank you in advance for your help.