From 69384ca31585c18242caaca96ca46d5ec06f7c84 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20T=C5=AFma?= Date: Wed, 7 Oct 2020 08:57:24 +0200 Subject: [PATCH] Some more Export dialogs polishing --- src/GUI/fileselectwidget.cpp | 3 ++- src/GUI/marginswidget.cpp | 14 ++++++++++---- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/src/GUI/fileselectwidget.cpp b/src/GUI/fileselectwidget.cpp index 3d6acd6f..014c0f3f 100644 --- a/src/GUI/fileselectwidget.cpp +++ b/src/GUI/fileselectwidget.cpp @@ -12,7 +12,8 @@ FileSelectWidget::FileSelectWidget(QWidget *parent) : QWidget(parent) { QFontMetrics fm(QApplication::font()); _edit = new QLineEdit(); - _edit->setMinimumWidth(fm.boundingRect(QDir::homePath()).width()); + _edit->setMinimumWidth(fm.averageCharWidth() * (QDir::homePath().length() + + 12)); #ifdef Q_OS_WIN32 _button = new QPushButton("..."); _button->setMaximumWidth(_button->sizeHint().width() / 2); diff --git a/src/GUI/marginswidget.cpp b/src/GUI/marginswidget.cpp index 05806399..208e8871 100644 --- a/src/GUI/marginswidget.cpp +++ b/src/GUI/marginswidget.cpp @@ -10,12 +10,10 @@ MarginsWidget::MarginsWidget(QWidget *parent) : QWidget(parent) _left = new QSpinBox(); _right = new QSpinBox(); -#ifdef Q_OS_WIN32 _top->setMaximumWidth(_top->sizeHint().width()); _bottom->setMaximumWidth(_bottom->sizeHint().width()); _left->setMaximumWidth(_left->sizeHint().width()); _right->setMaximumWidth(_right->sizeHint().width()); -#endif // W_OS_WIN32 QGridLayout *layout = new QGridLayout(); layout->addWidget(_top, 0, 0, 1, 2, Qt::AlignCenter); @@ -41,6 +39,11 @@ void MarginsWidget::setUnits(const QString &units) _bottom->setSuffix(UNIT_SPACE + units); _left->setSuffix(UNIT_SPACE + units); _right->setSuffix(UNIT_SPACE + units); + + _top->setMaximumWidth(_top->sizeHint().width()); + _bottom->setMaximumWidth(_bottom->sizeHint().width()); + _left->setMaximumWidth(_left->sizeHint().width()); + _right->setMaximumWidth(_right->sizeHint().width()); } QMargins MarginsWidget::value() const @@ -57,12 +60,10 @@ MarginsFWidget::MarginsFWidget(QWidget *parent) : QWidget(parent) _left = new QDoubleSpinBox(); _right = new QDoubleSpinBox(); -#ifdef Q_OS_WIN32 _top->setMaximumWidth(_top->sizeHint().width()); _bottom->setMaximumWidth(_bottom->sizeHint().width()); _left->setMaximumWidth(_left->sizeHint().width()); _right->setMaximumWidth(_right->sizeHint().width()); -#endif // Q_OS_WIN32 QGridLayout *layout = new QGridLayout(); layout->addWidget(_top, 0, 0, 1, 2, Qt::AlignCenter); @@ -88,6 +89,11 @@ void MarginsFWidget::setUnits(const QString &units) _bottom->setSuffix(UNIT_SPACE + units); _left->setSuffix(UNIT_SPACE + units); _right->setSuffix(UNIT_SPACE + units); + + _top->setMaximumWidth(_top->sizeHint().width()); + _bottom->setMaximumWidth(_bottom->sizeHint().width()); + _left->setMaximumWidth(_left->sizeHint().width()); + _right->setMaximumWidth(_right->sizeHint().width()); } void MarginsFWidget::setSingleStep(qreal step)