Fix comment view when they have line return.

Before, they grow row height but only show 2 lines.
Now, height stay at one line, but tooltip show the correct message.
This commit is contained in:
Phenom 2017-04-08 14:06:47 +02:00
parent 4067c95761
commit f175533d8d
2 changed files with 12 additions and 1 deletions

View File

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

View File

@ -25,6 +25,8 @@
#include "GxsCreateCommentDialog.h" #include "GxsCreateCommentDialog.h"
#include "ui_GxsCreateCommentDialog.h" #include "ui_GxsCreateCommentDialog.h"
#include "util/HandleRichText.h"
#include <QMessageBox> #include <QMessageBox>
#include <iostream> #include <iostream>
@ -45,7 +47,11 @@ void GxsCreateCommentDialog::createComment()
{ {
RsGxsComment comment; 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.mParentId = mParentId.second;
comment.mMeta.mGroupId = mParentId.first; comment.mMeta.mGroupId = mParentId.first;
comment.mMeta.mThreadId = mThreadId; comment.mMeta.mThreadId = mThreadId;