|
| LabelScl (QWidget *parent=nullptr) |
|
const QPixmap & | getPixmap () const |
| Use to get original image.
|
|
QPixmap | getPixmapScaled () const |
| Use to get image scaled to fit inside the label.
|
|
void | animPlay (bool start) |
| Use to start/stop animation set.
|
|
void | animStart () |
| Use to play animation set.
|
|
void | animStop () |
| Use to play animation set.
|
|
void | setImg (const QPixmap &pixmap) |
| Set image to use via a QPixmap.
|
|
void | setImg (const QImage &img) |
| Set image to use via a QImage.
|
|
void | setImg (const QImage *img) |
| Set image via a pointer to QImage.
|
|
void | setAnimation (const QString &animation) |
| Set animation to use.
|
|
void | setTextAlt (const QString &text) |
| Set text to display when no image has been set.
|
|
virtual int | heightForWidth (int width) const override |
|
virtual QSize | sizeHint () const override |
|
Label that will properly scale image or animation.
Include with:
#include "toolboxqt/widgets/labelscl.h"
QLabel doesn't behave properly when using it to display an image (or animation) that is loaded at runtime. Since size of image is not known when layout is rendered, QLabel size will be wrong and will not be properly updated when finally rendering an image (either too small, too big or not properly scaled). This class will manage this issue.
- Note
- Note that this class will be useful for QLabel containing image which are loaded at runtime. The described issue do not happen when image is available at compile-time.