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;
|
return m_requestActive;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
float PreviewImageItem::aspectRatio() const
|
||||||
|
{
|
||||||
|
return static_cast<float>(m_image.width()) / m_image.height();
|
||||||
|
}
|
||||||
|
|
||||||
void PreviewImageItem::setImageUrl( QUrl url)
|
void PreviewImageItem::setImageUrl( QUrl url)
|
||||||
{
|
{
|
||||||
if (m_imageUrl == url)
|
if (m_imageUrl == url)
|
||||||
|
|
|
@ -20,6 +20,7 @@ class PreviewImageItem : public QQuickItem
|
||||||
|
|
||||||
Q_PROPERTY(bool isLoading READ isLoading NOTIFY isLoadingChanged)
|
Q_PROPERTY(bool isLoading READ isLoading NOTIFY isLoadingChanged)
|
||||||
|
|
||||||
|
Q_PROPERTY(float aspectRatio READ aspectRatio NOTIFY sourceSizeChanged)
|
||||||
public:
|
public:
|
||||||
PreviewImageItem(QQuickItem* parent = nullptr);
|
PreviewImageItem(QQuickItem* parent = nullptr);
|
||||||
~PreviewImageItem();
|
~PreviewImageItem();
|
||||||
|
@ -34,6 +35,8 @@ public:
|
||||||
|
|
||||||
bool isLoading() const;
|
bool isLoading() const;
|
||||||
|
|
||||||
|
float aspectRatio() const;
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void imageUrlChanged();
|
void imageUrlChanged();
|
||||||
void sourceSizeChanged();
|
void sourceSizeChanged();
|
||||||
|
|
|
@ -11,7 +11,7 @@ Rectangle {
|
||||||
activePreview = 0
|
activePreview = 0
|
||||||
}
|
}
|
||||||
|
|
||||||
height: width / (16/9)
|
height: width / preview.aspectRatio
|
||||||
color: "#7f7f7f"
|
color: "#7f7f7f"
|
||||||
|
|
||||||
border.width: 1
|
border.width: 1
|
||||||
|
@ -22,6 +22,7 @@ Rectangle {
|
||||||
}
|
}
|
||||||
|
|
||||||
PreviewImage {
|
PreviewImage {
|
||||||
|
id: preview
|
||||||
width: parent.width
|
width: parent.width
|
||||||
height: parent.height
|
height: parent.height
|
||||||
imageUrl: __havePreviews ? root.previews[root.activePreview] : ""
|
imageUrl: __havePreviews ? root.previews[root.activePreview] : ""
|
||||||
|
|
Loading…
Add table
Reference in a new issue