Added ZoomableLabel for the Channel Post Feeds

This commit is contained in:
defnax 2020-11-29 16:46:02 +01:00
parent 38f9c81050
commit fa64fd0362
2 changed files with 15 additions and 14 deletions

View File

@ -221,6 +221,10 @@ void GxsChannelPostItem::setup()
//ui->subjectLabel->setMinimumWidth(100);
//ui->warning_label->setMinimumWidth(100);
ui->logoLabel->setEnableZoom(false);
int desired_height = QFontMetricsF(font()).height() * 8;
ui->logoLabel->setFixedSize(4/3.0*desired_height,desired_height);
ui->mainFrame->setProperty("new", false);
ui->mainFrame->style()->unpolish(ui->mainFrame);
ui->mainFrame->style()->polish( ui->mainFrame);
@ -435,24 +439,16 @@ void GxsChannelPostItem::fill()
if(mPost.mThumbnail.mData != NULL)
{
QPixmap thumbnail;
ui->logoLabel->setScaledContents(true);
ui->logoLabel->setScaledContents(true);
GxsIdDetails::loadPixmapFromData(mPost.mThumbnail.mData, mPost.mThumbnail.mSize, thumbnail,GxsIdDetails::ORIGINAL);
// Wiping data - as its been passed to thumbnail.
// if( thumbnail.width() < 90 ){
// ui->logoLabel->setMaximumSize(82*f,108*f);
// }
// else if( thumbnail.width() < 109 ){
// ui->logoLabel->setMinimumSize(108*f,108*f);
// ui->logoLabel->setMaximumSize(108*f,108*f);
// }
// else{
// ui->logoLabel->setMinimumSize(156*f,108*f);
// ui->logoLabel->setMaximumSize(156*f,108*f);
// }
ui->logoLabel->setPixmap(thumbnail);
}
else
ui->logoLabel->setPicture( FilesDefs::getPixmapFromQtResourcePath(":/images/thumb-default-video.png") );
if( !IS_GROUP_PUBLISHER(mGroupMeta.mSubscribeFlags) )
ui->editButton->hide() ;

View File

@ -52,7 +52,7 @@
<item>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QLabel" name="logoLabel">
<widget class="ZoomableLabel" name="logoLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Maximum">
<horstretch>0</horstretch>
@ -475,6 +475,11 @@
<header location="global">gui/common/ElidedLabel.h</header>
<container>1</container>
</customwidget>
<customwidget>
<class>ZoomableLabel</class>
<extends>QLabel</extends>
<header>gui/gxschannels/GxsChannelPostThumbnail.h</header>
</customwidget>
</customwidgets>
<resources/>
<connections/>