mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-12-24 06:59:27 -05:00
fixed aspect ratio
This commit is contained in:
parent
fcee6d3f63
commit
c4463ad5ba
@ -246,27 +246,25 @@ void PostedItem::fill()
|
||||
return;
|
||||
}
|
||||
|
||||
QPixmap sqpixmap2 = QPixmap(":/images/thumb-default.png");
|
||||
|
||||
mInFill = true;
|
||||
int desired_height = ui->voteDownButton->height() + ui->voteUpButton->height() + ui->scoreLabel->height();
|
||||
int desired_height = 1.5*(ui->voteDownButton->height() + ui->voteUpButton->height() + ui->scoreLabel->height());
|
||||
int desired_width = sqpixmap2.width()*desired_height/(float)sqpixmap2.height();
|
||||
|
||||
if(mPost.mImage.mData != NULL)
|
||||
{
|
||||
QPixmap pixmap;
|
||||
pixmap.loadFromData(mPost.mImage.mData, mPost.mImage.mSize, "PNG");
|
||||
// Wiping data - as its been passed to thumbnail.
|
||||
|
||||
QPixmap sqpixmap = pixmap.scaled(10*desired_height,1.5*desired_height, Qt::KeepAspectRatio, Qt::SmoothTransformation);
|
||||
ui->thumbnailLabel->setMaximumSize(sqpixmap.size());
|
||||
QPixmap sqpixmap = pixmap.scaled(desired_width,desired_height, Qt::KeepAspectRatioByExpanding, Qt::SmoothTransformation);
|
||||
ui->thumbnailLabel->setPixmap(sqpixmap);
|
||||
ui->pictureLabel->setPixmap(pixmap);
|
||||
std::cerr << "new size=" << desired_height << " " << sqpixmap.width() << " " << sqpixmap.height() << std::endl;
|
||||
}
|
||||
else
|
||||
{
|
||||
QPixmap sqpixmap = QPixmap(":/images/thumb-default.png").scaled(10*desired_height,1.5*desired_height, Qt::KeepAspectRatio, Qt::SmoothTransformation);
|
||||
|
||||
ui->thumbnailLabel->setMaximumSize(sqpixmap.size());
|
||||
ui->thumbnailLabel->setPixmap(sqpixmap);
|
||||
|
||||
ui->thumbnailLabel->setFixedSize(desired_width,desired_height);
|
||||
ui->expandButton->setDisabled(true);
|
||||
}
|
||||
|
||||
|
@ -187,7 +187,7 @@
|
||||
<item>
|
||||
<widget class="QLabel" name="thumbnailLabel">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Minimum">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
|
Loading…
Reference in New Issue
Block a user