Fix property editor on Mac OS.

--HG--
branch : develop
This commit is contained in:
Roman Telezhynskyi 2018-04-03 18:08:11 +03:00
parent c6e7590034
commit 911a85d79b
3 changed files with 8 additions and 8 deletions

View file

@ -35,6 +35,7 @@
#include <QColorDialog> #include <QColorDialog>
#include <QDebug> #include <QDebug>
#include <QRegularExpression> #include <QRegularExpression>
#include <QSpacerItem>
#include "../vpropertyexplorer/vproperty.h" #include "../vpropertyexplorer/vproperty.h"
#include "../vtools/dialogs/support/dialogeditwrongformula.h" #include "../vtools/dialogs/support/dialogeditwrongformula.h"
@ -42,7 +43,7 @@
// VFormulaPropertyEditor // VFormulaPropertyEditor
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
VFormulaPropertyEditor::VFormulaPropertyEditor(QWidget *parent) VFormulaPropertyEditor::VFormulaPropertyEditor(QWidget *parent)
: QWidget(parent), formula(VFormula()), ToolButton(nullptr), TextLabel(nullptr), Spacer(nullptr) : QWidget(parent), formula(VFormula()), ToolButton(nullptr), TextLabel(nullptr)
{ {
setAutoFillBackground(true); setAutoFillBackground(true);
@ -61,15 +62,13 @@ VFormulaPropertyEditor::VFormulaPropertyEditor(QWidget *parent)
TextLabel = new QLabel(this); TextLabel = new QLabel(this);
TextLabel->setText(formula.getStringValue()); TextLabel->setText(formula.getStringValue());
// Spacer (this is needed for proper display of the label and button)
Spacer = new QSpacerItem(1, 0, QSizePolicy::Expanding, QSizePolicy::Ignored);
// The layout (a horizontal layout) // The layout (a horizontal layout)
QHBoxLayout* layout = new QHBoxLayout(this); QHBoxLayout* layout = new QHBoxLayout(this);
layout->setSpacing(3); layout->setSpacing(3);
layout->setMargin(0); layout->setMargin(0);
layout->addWidget(TextLabel); layout->addWidget(TextLabel);
layout->addItem(Spacer); // Spacer (this is needed for proper display of the label and button)
layout->addSpacerItem(new QSpacerItem(1000000000, 0, QSizePolicy::Expanding, QSizePolicy::Expanding));
layout->addWidget(ToolButton); layout->addWidget(ToolButton);
} }

View file

@ -33,7 +33,6 @@
#include <QToolButton> #include <QToolButton>
#include <QLineEdit> #include <QLineEdit>
#include <QLabel> #include <QLabel>
#include <QSpacerItem>
#include "../vpatterndb/vformula.h" #include "../vpatterndb/vformula.h"
@ -72,7 +71,6 @@ private:
VFormula formula; VFormula formula;
QToolButton* ToolButton; QToolButton* ToolButton;
QLabel* TextLabel; QLabel* TextLabel;
QSpacerItem* Spacer;
}; };

View file

@ -103,6 +103,7 @@ void VPE::VPropertyFormWidget::build()
} }
QFormLayout* tmpFormLayout = new QFormLayout(this); QFormLayout* tmpFormLayout = new QFormLayout(this);
tmpFormLayout->setFieldGrowthPolicy(QFormLayout::ExpandingFieldsGrow);
setLayout(tmpFormLayout); setLayout(tmpFormLayout);
for (int i = 0; i < d_ptr->Properties.count(); ++i) for (int i = 0; i < d_ptr->Properties.count(); ++i)
@ -123,9 +124,11 @@ void VPE::VPropertyFormWidget::build()
tmpFormLayout->addRow(group); tmpFormLayout->addRow(group);
QFormLayout* subFormLayout = new QFormLayout(group); QFormLayout* subFormLayout = new QFormLayout(group);
subFormLayout->setFieldGrowthPolicy(QFormLayout::ExpandingFieldsGrow);
QMargins margins = subFormLayout->contentsMargins(); QMargins margins = subFormLayout->contentsMargins();
margins.setTop(0); margins.setTop(0);
margins.setLeft(14); margins.setLeft(18);
margins.setRight(0);
subFormLayout->setContentsMargins(margins); subFormLayout->setContentsMargins(margins);
group->setLayout(subFormLayout); group->setLayout(subFormLayout);