规整报错界面字体大小和布局
This commit is contained in:
parent
123d695110
commit
ef9353ee92
|
@ -1,3 +1,12 @@
|
|||
kolourpaint (4:23.08.3-ok3.2) nile; urgency=medium
|
||||
|
||||
* BUG号: 无
|
||||
* 需求号 : 无
|
||||
* 其他改动说明 : 修复报错显示字体大小问题和生成图片形状比例错误问题;
|
||||
* 其他改动影响域 : 无
|
||||
|
||||
-- shangxiaoyang <shangxiaoyang@kylinos.cn> Mon, 27 May 2024 14:52:54 +0800
|
||||
|
||||
kolourpaint (4:23.08.3-ok3.1) nile; urgency=medium
|
||||
|
||||
* BUG号:
|
||||
|
|
|
@ -828,13 +828,16 @@ QPixmap kpAIDrawingBar::createPixmapWithText(const QString &text)
|
|||
|
||||
// 设置字体和字体大小,这里假设使用默认字体,根据实际需求可自定义
|
||||
QFont font = painter.font();
|
||||
font.setPointSize(12);
|
||||
// 若需要调整字体大小以适应换行,请在此处设置,例如:font.setPointSize(10);
|
||||
|
||||
QRect textRect = pixmap.rect().adjusted(8, 8, -8, -8);
|
||||
// 计算文本在给定宽度下的自动换行字符串
|
||||
QString wrappedText = fontMetrics().elidedText(i18n(text.toLocal8Bit().data()), Qt::ElideNone, pixmap.rect().width(), Qt::TextWordWrap);
|
||||
QString wrappedText = fontMetrics().elidedText(i18n(text.toLocal8Bit().data()), Qt::ElideNone, textRect.width(), Qt::TextWordWrap);
|
||||
|
||||
painter.setFont(font);
|
||||
painter.setPen(color);
|
||||
painter.drawText(pixmap.rect(), Qt::AlignCenter | Qt::TextWordWrap, wrappedText);
|
||||
painter.drawText(textRect, Qt::AlignCenter | Qt::TextWordWrap, wrappedText);
|
||||
painter.end();
|
||||
|
||||
qDebug()<<"Error message:"<<i18n(text.toLocal8Bit().data())<<"size = "<<size;
|
||||
|
@ -1027,7 +1030,7 @@ QSize kpAIDrawingBar::getImageLabelSize()
|
|||
{
|
||||
imageColumn = 2;
|
||||
QSize labelSize = QSize(108,108);
|
||||
qreal ratio = showAIImageSize.width() / 108;
|
||||
double ratio = static_cast<double>(showAIImageSize.width()) / static_cast<double>(108);
|
||||
int height = showAIImageSize.height() / ratio;
|
||||
|
||||
if (height != 0)
|
||||
|
|
Loading…
Reference in New Issue