Fix a size policy for widgets in the property browser.
This commit is contained in:
parent
d5da8c6799
commit
42afd0e2f6
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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<double>::of(&QDoubleSpinBox::valueChanged), this, &VIntegerProperty::valueChanged);
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue
Block a user