From 42afd0e2f683fbf780b8a884de9df6008372a7da Mon Sep 17 00:00:00 2001 From: Roman Telezhynskyi Date: Thu, 29 Oct 2020 14:44:32 +0200 Subject: [PATCH] Fix a size policy for widgets in the property browser. --- src/app/valentina/core/vformulapropertyeditor.cpp | 8 +++++--- src/libs/vpropertyexplorer/plugins/vlabelproperty.cpp | 2 +- src/libs/vpropertyexplorer/plugins/vnumberproperty.cpp | 2 +- src/libs/vpropertyexplorer/plugins/vstringproperty.cpp | 2 +- 4 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/app/valentina/core/vformulapropertyeditor.cpp b/src/app/valentina/core/vformulapropertyeditor.cpp index 25560dcbe..a52a56771 100644 --- a/src/app/valentina/core/vformulapropertyeditor.cpp +++ b/src/app/valentina/core/vformulapropertyeditor.cpp @@ -49,10 +49,11 @@ VFormulaPropertyEditor::VFormulaPropertyEditor(QWidget *parent) // Create the tool button ToolButton = new QToolButton(this); - ToolButton->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Minimum); + ToolButton->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); ToolButton->setText("..."); ToolButton->setIcon(QIcon("://icon/16x16/fx.png")); - ToolButton->setFixedWidth(20); + ToolButton->setIconSize(QSize(16, 16)); + ToolButton->setFixedSize(24, 24); ToolButton->installEventFilter(this); setFocusProxy(ToolButton); // Make the ToolButton the focus proxy setFocusPolicy(ToolButton->focusPolicy()); @@ -60,6 +61,7 @@ VFormulaPropertyEditor::VFormulaPropertyEditor(QWidget *parent) // Create the text label TextLabel = new QLabel(this); + TextLabel->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred); TextLabel->setText(formula.getStringValue()); // The layout (a horizontal layout) @@ -68,7 +70,7 @@ VFormulaPropertyEditor::VFormulaPropertyEditor(QWidget *parent) layout->setMargin(0); layout->addWidget(TextLabel); // Spacer (this is needed for proper display of the label and button) - layout->addSpacerItem(new QSpacerItem(1000000000, 0, QSizePolicy::Expanding, QSizePolicy::Expanding)); + layout->addSpacerItem(new QSpacerItem(1000000000, 0, QSizePolicy::Expanding, QSizePolicy::Preferred)); layout->addWidget(ToolButton); } diff --git a/src/libs/vpropertyexplorer/plugins/vlabelproperty.cpp b/src/libs/vpropertyexplorer/plugins/vlabelproperty.cpp index 5fe26e85e..c295809bc 100644 --- a/src/libs/vpropertyexplorer/plugins/vlabelproperty.cpp +++ b/src/libs/vpropertyexplorer/plugins/vlabelproperty.cpp @@ -63,7 +63,7 @@ QWidget *VPE::VLabelProperty::createEditor(QWidget *parent, const QStyleOptionVi QLabel* tmpEditor = new QLabel(parent); tmpEditor->setLocale(parent->locale()); - tmpEditor->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); + tmpEditor->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred); tmpEditor->setText(d_ptr->VariantValue.toString()); d_ptr->editor = tmpEditor; diff --git a/src/libs/vpropertyexplorer/plugins/vnumberproperty.cpp b/src/libs/vpropertyexplorer/plugins/vnumberproperty.cpp index 37744c28c..fdb07d0d9 100644 --- a/src/libs/vpropertyexplorer/plugins/vnumberproperty.cpp +++ b/src/libs/vpropertyexplorer/plugins/vnumberproperty.cpp @@ -167,7 +167,7 @@ QWidget* VPE::VDoubleProperty::createEditor(QWidget * parent, const QStyleOption tmpEditor->setMaximum(maxValue); tmpEditor->setDecimals(Precision); tmpEditor->setSingleStep(singleStep); - tmpEditor->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); + tmpEditor->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred); tmpEditor->setValue(VProperty::d_ptr->VariantValue.toDouble()); connect(tmpEditor, QOverload::of(&QDoubleSpinBox::valueChanged), this, &VIntegerProperty::valueChanged); diff --git a/src/libs/vpropertyexplorer/plugins/vstringproperty.cpp b/src/libs/vpropertyexplorer/plugins/vstringproperty.cpp index abd6b7392..9c843a7ef 100644 --- a/src/libs/vpropertyexplorer/plugins/vstringproperty.cpp +++ b/src/libs/vpropertyexplorer/plugins/vstringproperty.cpp @@ -58,7 +58,7 @@ QWidget *VPE::VStringProperty::createEditor(QWidget *parent, const QStyleOptionV tmpEditor->setReadOnly(readOnly); tmpEditor->installEventFilter(this); tmpEditor->setClearButtonEnabled(clearButton); - tmpEditor->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); + tmpEditor->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred); tmpEditor->setText(d_ptr->VariantValue.toString()); d_ptr->editor = tmpEditor;