mirror of
https://gitea.msk.dinamika-avia.ru/Constanta-Design/RRJServer.git
synced 2026-03-28 19:55:48 +03:00
Рефакт
This commit is contained in:
@@ -90,9 +90,27 @@ void MsgWidget::on_textEdit_textChanged()
|
||||
|
||||
if(textRect.width() > widthEdit)
|
||||
{//Не помещается в одну строку
|
||||
textRect = metricsFont.boundingRect(QRect(0, 0, widthEdit, 10), Qt::TextWordWrap, text);
|
||||
ui->textEdit->setFixedHeight(textRect.height() + X);
|
||||
this->setFixedHeight(textRect.height() + X + 20 + 30);
|
||||
textRect = metricsFont.boundingRect(QRect(0, 0, widthEdit, 1000), 0, text);
|
||||
|
||||
|
||||
if(textRect.width() > widthEdit)
|
||||
{
|
||||
QRect textRect1str = metricsFont.boundingRect(QRect(0, 0, widthEdit, 1000), 0, "string");
|
||||
int ost = textRect.width() % widthEdit;
|
||||
int cnt = textRect.width() / widthEdit;
|
||||
if(ost > 0)
|
||||
cnt += 1;
|
||||
|
||||
this->setFixedHeight(textRect1str.height() * cnt + (ost? textRect1str.height() : 0) + X + 20 + 30);
|
||||
ui->textEdit->setFixedHeight(textRect1str.height() * cnt + (ost? textRect1str.height() : 0) + X);
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
this->setFixedHeight(textRect.height() + X + 20 + 30);
|
||||
ui->textEdit->setFixedHeight(textRect.height() + X);
|
||||
|
||||
}
|
||||
}
|
||||
else
|
||||
{//В одну строку
|
||||
|
||||
Reference in New Issue
Block a user