Merge pull request #2587 from csoler/v0.6-BugFixing_16

Bug fixing in PostedItem
This commit is contained in:
csoler 2022-02-23 23:28:31 +01:00 committed by GitHub
commit 1ddba795d4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 30 additions and 22 deletions

@ -1 +1 @@
Subproject commit 87fdae942186ab3412ce40438e30f76670dd55d0
Subproject commit 1965f200033cc6a5bbf46fcda21e87248b181076

View File

@ -495,7 +495,7 @@ void PostedItem::fill()
ui->voteUpButton->setDisabled(true);
ui->voteDownButton->setDisabled(true);
ui->thumbnailLabel->setPixmap( FilesDefs::getPixmapFromQtResourcePath(":/images/thumb-default.png"));
ui->thumbnailLabel->setPicture( FilesDefs::getPixmapFromQtResourcePath(":/images/thumb-default.png"));
ui->fromLabel->setId(mPost.mMeta.mAuthorId);
ui->titleLabel->setText(tr( "<p><font color=\"#ff0000\"><b>The author of this message (with ID %1) is banned.</b>").arg(QString::fromStdString(mPost.mMeta.mAuthorId.toStdString()))) ;
QDateTime qtime;
@ -509,8 +509,10 @@ void PostedItem::fill()
QPixmap sqpixmap2 = FilesDefs::getPixmapFromQtResourcePath(":/images/thumb-default.png");
mInFill = true;
int desired_height = 1.5*(ui->voteDownButton->height() + ui->voteUpButton->height() + ui->scoreLabel->height());
int desired_width = sqpixmap2.width()*desired_height/(float)sqpixmap2.height();
int desired_height = ui->voteDownButton->height() + ui->voteUpButton->height() + ui->scoreLabel->height();
int desired_width = 16/9.0 * desired_height; //sqpixmap2.width()*desired_height/(float)sqpixmap2.height();
ui->thumbnailLabel->setFixedSize(desired_width,desired_height);
QDateTime qtime;
qtime.setTime_t(mPost.mMeta.mPublishTs);
@ -573,18 +575,18 @@ void PostedItem::fill()
GxsIdDetails::loadPixmapFromData(mPost.mImage.mData, mPost.mImage.mSize, pixmap,GxsIdDetails::ORIGINAL);
// Wiping data - as its been passed to thumbnail.
QPixmap sqpixmap = pixmap.scaled(desired_width,desired_height, Qt::KeepAspectRatioByExpanding, Qt::SmoothTransformation);
ui->thumbnailLabel->setPixmap(sqpixmap);
// QPixmap sqpixmap = pixmap.scaled(desired_width,desired_height, Qt::KeepAspectRatioByExpanding, Qt::SmoothTransformation);
ui->thumbnailLabel->setPicture(pixmap);
ui->thumbnailLabel->setToolTip(tr("Click to view Picture"));
ui->thumbnailLabel->setEnableZoom(false);
QPixmap scaledpixmap;
if(pixmap.width() > 800){
QPixmap scaledpixmap = pixmap.scaledToWidth(800, Qt::SmoothTransformation);
ui->pictureLabel->setPixmap(scaledpixmap);
}else{
}else
ui->pictureLabel->setPixmap(pixmap);
}
}
else if (urlOkay && (mPost.mImage.mData == NULL))
{
ui->expandButton->setDisabled(true);

View File

@ -112,11 +112,11 @@ protected:
void setCommentsSize(int comNb) override;
private slots:
void doExpand(bool open);
void toggle();
void makeUpVote();
void makeDownVote();
void toggleNotes() ;
void doExpand(bool open) override;
void toggle() override;
void makeUpVote() override;
void makeDownVote() override;
void toggleNotes() override;
private:
/** Qt Designer generated object */

View File

@ -176,6 +176,12 @@
<property name="sizeType">
<enum>QSizePolicy::Expanding</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
</spacer>
</item>
</layout>
@ -190,7 +196,7 @@
<number>6</number>
</property>
<item>
<widget class="ClickableLabel" name="thumbnailLabel">
<widget class="ZoomableLabel" name="thumbnailLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
@ -732,15 +738,15 @@
<container>1</container>
</customwidget>
<customwidget>
<class>ClickableLabel</class>
<class>ZoomableLabel</class>
<extends>QLabel</extends>
<header>util/ClickableLabel.h</header>
<header>gui/gxschannels/GxsChannelPostThumbnail.h</header>
</customwidget>
</customwidgets>
<resources>
<include location="../images.qrc"/>
<include location="../icons.qrc"/>
<include location="Posted_images.qrc"/>
<include location="../icons.qrc"/>
</resources>
<connections/>
</ui>