diff --git a/src/gui/addnewtorrentdialog.cpp b/src/gui/addnewtorrentdialog.cpp
index cb95fab2c..54a06ffcc 100644
--- a/src/gui/addnewtorrentdialog.cpp
+++ b/src/gui/addnewtorrentdialog.cpp
@@ -670,7 +670,7 @@ void AddNewTorrentDialog::setMetadataProgressIndicator(bool visibleIndicator, co
void AddNewTorrentDialog::setupTreeview()
{
if (!m_hasMetadata) {
- ui->comment_lbl->setText(tr("Not Available", "This comment is unavailable"));
+ setCommentText(tr("Not Available", "This comment is unavailable"));
ui->date_lbl->setText(tr("Not Available", "This date is unavailable"));
}
else {
@@ -678,7 +678,7 @@ void AddNewTorrentDialog::setupTreeview()
setWindowTitle(m_torrentInfo.name());
// Set torrent information
- ui->comment_lbl->setText(Utils::Misc::parseHtmlLinks(m_torrentInfo.comment()));
+ setCommentText(Utils::Misc::parseHtmlLinks(m_torrentInfo.comment()));
ui->date_lbl->setText(!m_torrentInfo.creationDate().isNull() ? m_torrentInfo.creationDate().toString(Qt::DefaultLocaleShortDate) : tr("Not available"));
// Prepare content tree
@@ -737,3 +737,14 @@ void AddNewTorrentDialog::handleDownloadFinished(const QString &url, const QStri
else
this->deleteLater();
}
+
+void AddNewTorrentDialog::setCommentText(const QString &str) const
+{
+ ui->commentLabel->setText(str);
+
+ // workaround for the additional space introduced by QScrollArea
+ int lineHeight = ui->commentLabel->fontMetrics().lineSpacing();
+ int lines = 1 + str.count("\n");
+ int height = lineHeight * lines;
+ ui->scrollArea->setMaximumHeight(height);
+}
diff --git a/src/gui/addnewtorrentdialog.h b/src/gui/addnewtorrentdialog.h
index 5de761b87..9b6d33536 100644
--- a/src/gui/addnewtorrentdialog.h
+++ b/src/gui/addnewtorrentdialog.h
@@ -92,6 +92,7 @@ private:
void saveState();
void setMetadataProgressIndicator(bool visibleIndicator, const QString &labelText = QString());
void setupTreeview();
+ void setCommentText(const QString &str) const;
private:
Ui::AddNewTorrentDialog *ui;
diff --git a/src/gui/addnewtorrentdialog.ui b/src/gui/addnewtorrentdialog.ui
index a83c26e11..d90ab437c 100644
--- a/src/gui/addnewtorrentdialog.ui
+++ b/src/gui/addnewtorrentdialog.ui
@@ -243,7 +243,7 @@
0
-
-
+
Qt::RichText