Skip to content
Snippets Groups Projects
Commit f1a8a45a authored by Mikhail Svechnikov's avatar Mikhail Svechnikov
Browse files

suppress warning

parent 7d0d03c3
No related branches found
No related tags found
1 merge request!2040Suppress Qt warning when changing detector alignment (#714)
Pipeline #115405 passed
...@@ -14,6 +14,7 @@ ...@@ -14,6 +14,7 @@
#include "GUI/View/Device/DetectorAlignmentForm.h" #include "GUI/View/Device/DetectorAlignmentForm.h"
#include "GUI/Model/Detector/DetectorItem.h" #include "GUI/Model/Detector/DetectorItem.h"
#include "GUI/Support/Tool/LayoutUtil.h"
#include "GUI/View/Numeric/ComboUtil.h" #include "GUI/View/Numeric/ComboUtil.h"
#include "GUI/View/Numeric/DoubleSpinBox.h" #include "GUI/View/Numeric/DoubleSpinBox.h"
#include "GUI/View/Numeric/NumWidgetUtil.h" #include "GUI/View/Numeric/NumWidgetUtil.h"
...@@ -41,17 +42,22 @@ DetectorAlignmentForm::DetectorAlignmentForm(QWidget* parent, DetectorItem* item ...@@ -41,17 +42,22 @@ DetectorAlignmentForm::DetectorAlignmentForm(QWidget* parent, DetectorItem* item
, m_item(item) , m_item(item)
{ {
ASSERT(m_item); ASSERT(m_item);
m_formLayout = new QFormLayout(this); QFormLayout* mainLayout = new QFormLayout(this);
m_formLayout->setContentsMargins(0, 15, 0, 0); mainLayout->setContentsMargins(0, 15, 0, 0);
m_formLayout->setSpacing(8); mainLayout->setSpacing(8);
m_formLayout->addRow("Alignment:", GUI::Util::createSafeComboBox( mainLayout->addRow("Alignment:", GUI::Util::createSafeComboBox(
[item] { return item->detectorAlignmentCombo(); }, [item] { return item->detectorAlignmentCombo(); },
[this, item](const QString& t) { [this, item](const QString& t) {
item->setDetectorAlignment(t); item->setDetectorAlignment(t);
createAligmentWidgets(); createAligmentWidgets();
emit dataChanged(); emit dataChanged();
})); }));
m_formLayout = new QFormLayout;
m_formLayout->setFieldGrowthPolicy(QFormLayout::FieldsStayAtSizeHint);
m_formLayout->setContentsMargins(0, 0, 0, 0);
mainLayout->addRow(m_formLayout);
createAligmentWidgets(); createAligmentWidgets();
} }
...@@ -101,18 +107,13 @@ void DetectorAlignmentForm::addVector(QFormLayout* parentLayout, VectorProperty& ...@@ -101,18 +107,13 @@ void DetectorAlignmentForm::addVector(QFormLayout* parentLayout, VectorProperty&
void DetectorAlignmentForm::createAligmentWidgets() void DetectorAlignmentForm::createAligmentWidgets()
{ {
while (m_formLayout->rowCount() > 1) GUI::Util::Layout::clearLayout(m_formLayout);
m_formLayout->removeRow(1);
const QString descr = alignmentDescription(m_item->detectorAlignment()); const QString descr = alignmentDescription(m_item->detectorAlignment());
auto* layout = new QFormLayout;
layout->setFieldGrowthPolicy(QFormLayout::FieldsStayAtSizeHint);
layout->setContentsMargins(0, 0, 0, 0);
m_formLayout->addRow("", layout);
auto* layoutUVD = new QFormLayout; auto* layoutUVD = new QFormLayout;
createSpinBox(layoutUVD, m_item->u0()); createSpinBox(layoutUVD, m_item->u0());
createSpinBox(layoutUVD, m_item->v0()); createSpinBox(layoutUVD, m_item->v0());
createSpinBox(layoutUVD, m_item->distance()); createSpinBox(layoutUVD, m_item->distance());
layout->addRow(descr + ":", layoutUVD); m_formLayout->addRow(descr + ":", layoutUVD);
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment