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 <QDebug>
#include <QRegularExpression>
#include <QSpacerItem>
#include "../vpropertyexplorer/vproperty.h"
#include "../vtools/dialogs/support/dialogeditwrongformula.h"
@ -42,7 +43,7 @@
// VFormulaPropertyEditor
//---------------------------------------------------------------------------------------------------------------------
VFormulaPropertyEditor::VFormulaPropertyEditor(QWidget *parent)
: QWidget(parent), formula(VFormula()), ToolButton(nullptr), TextLabel(nullptr), Spacer(nullptr)
: QWidget(parent), formula(VFormula()), ToolButton(nullptr), TextLabel(nullptr)
{
setAutoFillBackground(true);
@ -61,15 +62,13 @@ VFormulaPropertyEditor::VFormulaPropertyEditor(QWidget *parent)
TextLabel = new QLabel(this);
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)
QHBoxLayout* layout = new QHBoxLayout(this);
layout->setSpacing(3);
layout->setMargin(0);
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);
}

View File

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

View File

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