Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 7 additions & 5 deletions dde-license-dialog/src/content.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,12 @@
#include <QDebug>
#include <QFontMetrics>
#include <QScroller>
#include <QtConcurrent>

Check warning on line 21 in dde-license-dialog/src/content.cpp

View workflow job for this annotation

GitHub Actions / cppcheck

Include file: <QtConcurrent> not found. Please note: Cppcheck does not need standard library headers to get proper results.
#include <QThread>

Check warning on line 22 in dde-license-dialog/src/content.cpp

View workflow job for this annotation

GitHub Actions / cppcheck

Include file: <QThread> not found. Please note: Cppcheck does not need standard library headers to get proper results.
#include <QTranslator>

Check warning on line 23 in dde-license-dialog/src/content.cpp

View workflow job for this annotation

GitHub Actions / cppcheck

Include file: <QTranslator> not found. Please note: Cppcheck does not need standard library headers to get proper results.
#include <QTextDocument>

Check warning on line 24 in dde-license-dialog/src/content.cpp

View workflow job for this annotation

GitHub Actions / cppcheck

Include file: <QTextDocument> not found. Please note: Cppcheck does not need standard library headers to get proper results.

#include <unistd.h>

Check warning on line 26 in dde-license-dialog/src/content.cpp

View workflow job for this annotation

GitHub Actions / cppcheck

Include file: <unistd.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.

DWIDGET_USE_NAMESPACE

Expand Down Expand Up @@ -278,10 +279,11 @@
// 根据文本多少,调整窗口大小
void Content::updateWindowHeight()
{
QRect rc = m_source->rect();
rc.setWidth(rc.width() - 40);
QSize sz = m_source->fontMetrics().boundingRect(rc, Qt::TextWordWrap, m_source->text()).size();

int minHeight = qBound(300, sz.height(), 491);
QTextDocument doc;
doc.setHtml(m_source->text());
doc.setTextWidth(m_scrollArea->width() - 40);

int contentHeight = static_cast<int>(doc.size().height());
int minHeight = qBound(100, contentHeight, 491);
m_scrollArea->setMinimumHeight(minHeight);
}