force aspect ratio for skin preview
Signed-off-by: Trial97 <alexandru.tripon97@gmail.com>
This commit is contained in:
parent
3c4eed13a3
commit
d5fb9f0935
@ -118,7 +118,7 @@ void SkinManageDialog::selectionChanged(QItemSelection selected, QItemSelection
|
||||
auto skin = m_list.skin(key);
|
||||
if (!skin)
|
||||
return;
|
||||
ui->selectedModel->setPixmap(skin->getTexture().scaled(128, 128, Qt::KeepAspectRatio, Qt::FastTransformation));
|
||||
ui->selectedModel->setPixmap(skin->getTexture().scaled(size() * (1. / 3), Qt::KeepAspectRatio, Qt::FastTransformation));
|
||||
ui->capeCombo->setCurrentIndex(m_capes_idx.value(skin->getCapeId()));
|
||||
ui->steveBtn->setChecked(skin->getModel() == SkinModel::CLASSIC);
|
||||
ui->alexBtn->setChecked(skin->getModel() == SkinModel::SLIM);
|
||||
@ -212,7 +212,7 @@ void SkinManageDialog::setupCapes()
|
||||
void SkinManageDialog::on_capeCombo_currentIndexChanged(int index)
|
||||
{
|
||||
auto id = ui->capeCombo->currentData();
|
||||
ui->capeImage->setPixmap(m_capes.value(id.toString(), {}));
|
||||
ui->capeImage->setPixmap(m_capes.value(id.toString(), {}).scaled(size() * (1. / 3), Qt::KeepAspectRatio, Qt::FastTransformation));
|
||||
if (auto skin = m_list.skin(m_selected_skin); skin) {
|
||||
skin->setCapeId(id.toString());
|
||||
}
|
||||
@ -498,3 +498,15 @@ void SkinManageDialog::on_userBtn_clicked()
|
||||
}
|
||||
m_list.updateSkin(&s);
|
||||
}
|
||||
|
||||
void SkinManageDialog::resizeEvent(QResizeEvent* event)
|
||||
{
|
||||
QWidget::resizeEvent(event);
|
||||
QSize s = size() * (1. / 3);
|
||||
|
||||
if (auto skin = m_list.skin(m_selected_skin); skin) {
|
||||
ui->selectedModel->setPixmap(skin->getTexture().scaled(s, Qt::KeepAspectRatio, Qt::FastTransformation));
|
||||
}
|
||||
auto id = ui->capeCombo->currentData();
|
||||
ui->capeImage->setPixmap(m_capes.value(id.toString(), {}).scaled(s, Qt::KeepAspectRatio, Qt::FastTransformation));
|
||||
}
|
||||
|
@ -34,6 +34,7 @@ class SkinManageDialog : public QDialog {
|
||||
public:
|
||||
explicit SkinManageDialog(QWidget* parent, MinecraftAccountPtr acct);
|
||||
virtual ~SkinManageDialog();
|
||||
void resizeEvent(QResizeEvent* event) override;
|
||||
|
||||
public slots:
|
||||
void selectionChanged(QItemSelection, QItemSelection);
|
||||
|
@ -24,7 +24,10 @@
|
||||
<string/>
|
||||
</property>
|
||||
<property name="scaledContents">
|
||||
<bool>true</bool>
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
@ -75,7 +78,10 @@
|
||||
<string/>
|
||||
</property>
|
||||
<property name="scaledContents">
|
||||
<bool>true</bool>
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
|
Loading…
Reference in New Issue
Block a user