Merge pull request #767 from PhenomRetroShare/Fix_CommentWithLineReturn

Fix comment view when they have line return.
This commit is contained in:
csoler 2017-04-18 20:28:36 +02:00 committed by GitHub
commit e95ddb91af
2 changed files with 12 additions and 1 deletions

View File

@ -25,6 +25,7 @@
#include <QDateTime>
#include <QMenu>
#include "gui/common/RSElidedItemDelegate.h"
#include "gui/gxs/GxsCommentTreeWidget.h"
#include "gui/gxs/GxsCreateCommentDialog.h"
#include "gui/gxs/GxsIdTreeWidgetItem.h"
@ -57,6 +58,10 @@ GxsCommentTreeWidget::GxsCommentTreeWidget(QWidget *parent)
// QTreeWidget* widget = this;
setContextMenuPolicy(Qt::CustomContextMenu);
RSElidedItemDelegate *itemDelegate = new RSElidedItemDelegate(this);
itemDelegate->setSpacing(QSize(0, 2));
setItemDelegate(itemDelegate);
setWordWrap(true);
// QFont font = QFont("ARIAL", 10);
// font.setBold(true);

View File

@ -25,6 +25,8 @@
#include "GxsCreateCommentDialog.h"
#include "ui_GxsCreateCommentDialog.h"
#include "util/HandleRichText.h"
#include <QMessageBox>
#include <iostream>
@ -45,7 +47,11 @@ void GxsCreateCommentDialog::createComment()
{
RsGxsComment comment;
comment.mComment = std::string(ui->commentTextEdit->document()->toPlainText().toUtf8());
QString text = ui->commentTextEdit->toHtml();
RsHtml::optimizeHtml(text);
std::string msg = text.toUtf8().constData();
comment.mComment = msg;
comment.mMeta.mParentId = mParentId.second;
comment.mMeta.mGroupId = mParentId.first;
comment.mMeta.mThreadId = mThreadId;