mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2025-12-22 08:27:24 -06:00
Fix additional space in comment label
This commit is contained in:
committed by
sledgehammer999
parent
f2c24dd8c3
commit
72883ffb73
@@ -670,7 +670,7 @@ void AddNewTorrentDialog::setMetadataProgressIndicator(bool visibleIndicator, co
|
|||||||
void AddNewTorrentDialog::setupTreeview()
|
void AddNewTorrentDialog::setupTreeview()
|
||||||
{
|
{
|
||||||
if (!m_hasMetadata) {
|
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"));
|
ui->date_lbl->setText(tr("Not Available", "This date is unavailable"));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@@ -678,7 +678,7 @@ void AddNewTorrentDialog::setupTreeview()
|
|||||||
setWindowTitle(m_torrentInfo.name());
|
setWindowTitle(m_torrentInfo.name());
|
||||||
|
|
||||||
// Set torrent information
|
// 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"));
|
ui->date_lbl->setText(!m_torrentInfo.creationDate().isNull() ? m_torrentInfo.creationDate().toString(Qt::DefaultLocaleShortDate) : tr("Not available"));
|
||||||
|
|
||||||
// Prepare content tree
|
// Prepare content tree
|
||||||
@@ -737,3 +737,14 @@ void AddNewTorrentDialog::handleDownloadFinished(const QString &url, const QStri
|
|||||||
else
|
else
|
||||||
this->deleteLater();
|
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);
|
||||||
|
}
|
||||||
|
|||||||
@@ -92,6 +92,7 @@ private:
|
|||||||
void saveState();
|
void saveState();
|
||||||
void setMetadataProgressIndicator(bool visibleIndicator, const QString &labelText = QString());
|
void setMetadataProgressIndicator(bool visibleIndicator, const QString &labelText = QString());
|
||||||
void setupTreeview();
|
void setupTreeview();
|
||||||
|
void setCommentText(const QString &str) const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Ui::AddNewTorrentDialog *ui;
|
Ui::AddNewTorrentDialog *ui;
|
||||||
|
|||||||
@@ -243,7 +243,7 @@
|
|||||||
<number>0</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLabel" name="comment_lbl">
|
<widget class="QLabel" name="commentLabel">
|
||||||
<property name="textFormat">
|
<property name="textFormat">
|
||||||
<enum>Qt::RichText</enum>
|
<enum>Qt::RichText</enum>
|
||||||
</property>
|
</property>
|
||||||
|
|||||||
Reference in New Issue
Block a user