From be6bea234b384af1935b43683314a0a121f31cf1 Mon Sep 17 00:00:00 2001 From: itsmattkc Date: Tue, 31 Mar 2020 12:41:08 +1100 Subject: [PATCH] exportdialog: make integer slider for crf smaller Using QSizePolicys seemed to always produce some variant of the IntegerSlider and QSlider consuming roughly half of the width each. The IntegerSlider is only two characters wide at any one time so this results in a lot of wasted screen real estate. This commit limits the integer slider to 4 characters wide (more than 2 to allow for UI padding) --- app/dialog/export/codec/h264section.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/dialog/export/codec/h264section.cpp b/app/dialog/export/codec/h264section.cpp index cfbd49f2f..97419b827 100644 --- a/app/dialog/export/codec/h264section.cpp +++ b/app/dialog/export/codec/h264section.cpp @@ -5,6 +5,7 @@ #include #include +#include "common/qtutils.h" #include "widget/slider/integerslider.h" H264Section::H264Section(QWidget *parent) : @@ -88,14 +89,13 @@ H264CRFSection::H264CRFSection(QWidget *parent) : layout->setMargin(0); crf_slider_ = new QSlider(Qt::Horizontal); - crf_slider_->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Expanding); crf_slider_->setMinimum(kMinimumCRF); crf_slider_->setMaximum(kMaximumCRF); crf_slider_->setValue(kDefaultCRF); layout->addWidget(crf_slider_); IntegerSlider* crf_input = new IntegerSlider(); - crf_input->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Expanding); + crf_input->setMaximumWidth(QFontMetricsWidth(crf_input->fontMetrics(), QStringLiteral("HHHH"))); crf_input->SetMinimum(kMinimumCRF); crf_input->SetMaximum(kMaximumCRF); crf_input->SetValue(kDefaultCRF);