1
0
Fork 0

Launcher: fix preview image aspect ratio

Accidentally left in a hard-coded 16:9 ratio, no wonder some images got
squished. Shuttle is now re-elongated verticallitaly :)
This commit is contained in:
James Turner 2018-03-06 18:34:54 +00:00
parent ab8ca2d832
commit 7b7e50741f
3 changed files with 10 additions and 1 deletions

View file

@ -73,6 +73,11 @@ bool PreviewImageItem::isLoading() const
return m_requestActive;
}
float PreviewImageItem::aspectRatio() const
{
return static_cast<float>(m_image.width()) / m_image.height();
}
void PreviewImageItem::setImageUrl( QUrl url)
{
if (m_imageUrl == url)

View file

@ -20,6 +20,7 @@ class PreviewImageItem : public QQuickItem
Q_PROPERTY(bool isLoading READ isLoading NOTIFY isLoadingChanged)
Q_PROPERTY(float aspectRatio READ aspectRatio NOTIFY sourceSizeChanged)
public:
PreviewImageItem(QQuickItem* parent = nullptr);
~PreviewImageItem();
@ -34,6 +35,8 @@ public:
bool isLoading() const;
float aspectRatio() const;
signals:
void imageUrlChanged();
void sourceSizeChanged();

View file

@ -11,7 +11,7 @@ Rectangle {
activePreview = 0
}
height: width / (16/9)
height: width / preview.aspectRatio
color: "#7f7f7f"
border.width: 1
@ -22,6 +22,7 @@ Rectangle {
}
PreviewImage {
id: preview
width: parent.width
height: parent.height
imageUrl: __havePreviews ? root.previews[root.activePreview] : ""