fix descriptionText size

This commit is contained in:
DanielSvoboda 2024-10-09 12:34:44 -03:00
parent ddb0928f10
commit 2ece948a8c
2 changed files with 13 additions and 3 deletions

View File

@ -53,6 +53,7 @@ SettingsDialog::SettingsDialog(std::span<const QString> physical_devices, QWidge
: QDialog(parent), ui(new Ui::SettingsDialog) {
ui->setupUi(this);
ui->tabWidgetSettings->setUsesScrollButtons(false);
initialHeight = this->height();
const auto config_dir = Common::FS::GetUserPath(Common::FS::PathType::UserDir);
ui->buttonBox->button(QDialogButtonBox::StandardButton::Close)->setFocus();
@ -430,15 +431,22 @@ bool SettingsDialog::eventFilter(QObject* obj, QEvent* event) {
}
// if the text exceeds the size of the box, it will increase the size
QRect currentGeometry = this->geometry();
int newWidth = currentGeometry.width();
int documentHeight = ui->descriptionText->document()->size().height();
int visibleHeight = ui->descriptionText->viewport()->height();
if (documentHeight > visibleHeight) {
ui->descriptionText->setMinimumHeight(90);
this->setGeometry(currentGeometry.x(), currentGeometry.y(), newWidth,
currentGeometry.height() + 40);
ui->descriptionText->setMaximumSize(16777215, 110);
} else {
ui->descriptionText->setMinimumHeight(70);
this->setGeometry(currentGeometry.x(), currentGeometry.y(), newWidth,
initialHeight);
ui->descriptionText->setMaximumSize(16777215, 70);
}
return true;
}
}
return QDialog::eventFilter(obj, event);
}
}

View File

@ -40,4 +40,6 @@ private:
std::map<std::string, int> languages;
QString defaultTextEdit;
int initialHeight;
};