Fixed size of animated preview in boxes.

This commit is contained in:
23rd 2021-07-19 21:19:11 +03:00 committed by John Preston
parent 773912f586
commit cba0ebce6e
3 changed files with 9 additions and 3 deletions

View File

@ -107,11 +107,15 @@ void AbstractSingleMediaPreview::preparePreview(QImage preview) {
_preview = PixmapFromImage(std::move(preview));
_preview.setDevicePixelRatio(style::DevicePixelRatio());
updatePhotoEditorButton();
resize(width(), std::max(_previewHeight, _minThumbH));
}
void AbstractSingleMediaPreview::updatePhotoEditorButton() {
_photoEditorButton->resize(_previewWidth, _previewHeight);
_photoEditorButton->moveToLeft(_previewLeft, _previewTop);
_photoEditorButton->setVisible(isPhoto());
resize(width(), std::max(_previewHeight, _minThumbH));
}
void AbstractSingleMediaPreview::resizeEvent(QResizeEvent *e) {

View File

@ -29,6 +29,7 @@ protected:
virtual bool tryPaintAnimation(Painter &p) = 0;
virtual bool isAnimatedPreviewReady() const = 0;
void updatePhotoEditorButton();
void preparePreview(QImage preview);
int previewLeft() const;

View File

@ -63,8 +63,9 @@ SingleMediaPreview::SingleMediaPreview(
Expects(!preview.isNull());
setAnimated(animated);
prepareAnimatedPreview(animatedPreviewPath, animated);
preparePreview(preview);
prepareAnimatedPreview(animatedPreviewPath, animated);
updatePhotoEditorButton();
}
bool SingleMediaPreview::drawBackground() const {