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:
parent
ab8ca2d832
commit
7b7e50741f
3 changed files with 10 additions and 1 deletions
|
@ -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)
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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] : ""
|
||||
|
|
Loading…
Reference in a new issue