Can load remote images and cache them locally.

This commit is contained in:
2018-12-18 18:31:51 +01:00
parent 6e7645f17b
commit 0148f7aaa5
11 changed files with 379 additions and 3 deletions

41
data/qlabelholder.h Normal file
View File

@ -0,0 +1,41 @@
/**
* QLabelHolder
*
* This file should be referenced by ImageLoadHelper ONLY !!!
*
* @author Pierre HUBERT
*/
#pragma once
#include <QObject>
#include <QLabel>
/**
* This class is used to avoid memory leak if attempting to
* apply downloaded image to a deleted label
*/
class QLabelHolder : public QObject
{
Q_OBJECT
public:
QLabelHolder(QLabel *label) {
mLabel = label;
connect(label, &QLabel::destroyed, this, &QLabelHolder::deleted);
}
QLabel *label(){
return mLabel;
}
private slots:
void deleted(){
mLabel = nullptr;
}
private:
//Private fields
QLabel *mLabel;
};