properly hide the msgFrame when msg is empty in channel post item

This commit is contained in:
csoler 2020-01-18 18:20:29 +01:00
parent 99a106d277
commit ab2e116fd2
No known key found for this signature in database
GPG Key ID: 7BCA522266C0804C

View File

@ -471,7 +471,13 @@ void GxsChannelPostItem::fill()
voteDownButton->setEnabled(false); voteDownButton->setEnabled(false);
}*/ }*/
ui->msgFrame->setVisible(!mPost.mMsg.empty()); {
QTextDocument doc;
doc.setHtml( QString::fromUtf8(mPost.mMsg.c_str()) );
ui->msgFrame->setVisible(doc.toPlainText().length() > 0);
}
if (wasExpanded() || ui->expandFrame->isVisible()) { if (wasExpanded() || ui->expandFrame->isVisible()) {
fillExpandFrame(); fillExpandFrame();
} }
@ -524,7 +530,7 @@ void GxsChannelPostItem::fill()
void GxsChannelPostItem::fillExpandFrame() void GxsChannelPostItem::fillExpandFrame()
{ {
ui->msgLabel->setText(RsHtml().formatText(NULL, QString::fromUtf8(mPost.mMsg.c_str()), RSHTML_FORMATTEXT_EMBED_SMILEYS | RSHTML_FORMATTEXT_EMBED_LINKS)); ui->msgLabel->setText(RsHtml().formatText(NULL, QString::fromUtf8(mPost.mMsg.c_str()), RSHTML_FORMATTEXT_EMBED_SMILEYS | RSHTML_FORMATTEXT_EMBED_LINKS));
ui->msgFrame->setVisible(!mPost.mMsg.empty());
} }
QString GxsChannelPostItem::messageName() QString GxsChannelPostItem::messageName()