Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
BornAgain
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
mlz
BornAgain
Commits
e5d183ec
Commit
e5d183ec
authored
1 year ago
by
Wuttke, Joachim
Browse files
Options
Downloads
Patches
Plain Diff
rm accidentally commited backup file
parent
51cf679a
No related branches found
Branches containing commit
No related tags found
1 merge request
!2445
frames and axis panels now stateless, and created at startup
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
GUI/View/Setup/#AxisPanel.cpp#
+0
-158
0 additions, 158 deletions
GUI/View/Setup/#AxisPanel.cpp#
with
0 additions
and
158 deletions
GUI/View/Setup/#AxisPanel.cpp#
deleted
100644 → 0
+
0
−
158
View file @
51cf679a
// ************************************************************************************************
//
// BornAgain: simulate and fit reflection and scattering
//
//! @file GUI/View/Setup/AxisPanel.cpp
//! @brief Implements class AxisPanel.
//!
//! @homepage http://www.bornagainproject.org
//! @license GNU General Public License v3 or higher (see COPYING)
//! @copyright Forschungszentrum Jülich GmbH 2018
//! @authors Scientific Computing Group at MLZ (see CITATION, AUTHORS)
//
// ************************************************************************************************
#include "GUI/View/Setup/AxisPanel.h"
#include "Base/Axis/Frame.h"
#include "Base/Util/Assert.h"
#include "GUI/Model/Axis/AmplitudeAxisItem.h"
#include "GUI/Model/Axis/BasicAxisItem.h"
#include "GUI/Model/Data/Data1DItem.h"
#include "GUI/Model/Data/DataItem.h"
#include "GUI/Model/Device/InstrumentItems.h"
#include "GUI/Model/Files/DatafileItem.h"
#include "GUI/Model/Job/DataSource.h"
#include "GUI/Model/Project/ProjectDocument.h"
#include "GUI/Support/Data/ComboProperty.h"
#include "GUI/View/Layout/LayoutUtil.h"
#include "GUI/View/Numeric/DoubleSpinBox.h"
#include "GUI/View/Numeric/NumWidgetUtil.h"
#include "GUI/View/Widget/GroupBoxes.h"
#include <QAction>
#include <QCheckBox>
#include <QFormLayout>
#include <QLineEdit>
AxisPanel::AxisPanel(QObject* item)
: m_data_source(std::make_unique<DataSource>(item))
{
setWindowTitle("Properties");
setSizePolicy(QSizePolicy::Fixed, QSizePolicy::MinimumExpanding);
auto* main_layout = new QFormLayout(this);
main_layout->setContentsMargins(8, 20, 8, 8);
main_layout->setSpacing(5);
// -- x-axis
auto* xGroup = new StaticGroupBox("X axis", this);
auto* xFormLayout = new QFormLayout(xGroup->body());
xFormLayout->setContentsMargins(0, 0, 0, 0);
xFormLayout->setSpacing(5);
xFormLayout->addRow("Min:",
GUI::Util::createDoubleSpinBox(
[this] { return m_data_source->currentData1DItem()->axItemX()->min(); },
[this](double newValue) {
m_data_source->currentData1DItem()->for (auto* item : m_data_source->allData1DItems())
item->axItemX()->setMin(newValue);
gDoc->setModified();
},
&m_updaters));
xFormLayout->addRow("Max:",
GUI::Util::createDoubleSpinBox(
[this] { return m_data_source->currentData1DItem()->axItemX()->max(); },
[this](double newValue) {
m_data_source->currentData1DItem()->for (auto* item : m_data_source->allData1DItems())
item->axItemX()->setMax(newValue);
gDoc->setModified();
},
&m_updaters));
main_layout->addRow(xGroup);
// -- y-axis
auto* yGroup = new StaticGroupBox("Y axis", this);
auto* yFormLayout = new QFormLayout(yGroup->body());
yFormLayout->setContentsMargins(0, 0, 0, 0);
yFormLayout->setSpacing(5);
auto* logRangeSpinBox = GUI::Util::createDoubleSpinBox(
[this] { return m_data_source->currentData1DItem()->axItemY()->logRangeOrders(); },
[this](double newValue) {
m_data_source->currentData1DItem()->for (auto* item : m_data_source->mainData1DItems()) {
item->axItemY()->setLogRangeOrders(newValue);
updateUIValues();
}
gDoc->setModified();
},
&m_updaters, "Dynamic range to display values", RealLimits::positive());
yFormLayout->addRow("Min:",
GUI::Util::createDoubleSpinBox(
[this] { return m_data_source->currentData1DItem()->axItemY()->min(); },
[this](double newValue) {
m_data_source->currentData1DItem()->for (auto* item : m_data_source->mainData1DItems()) {
item->axItemY()->setMin(newValue);
item->axItemY()->adjustLogRangeOrders();
updateUIValues();
}
gDoc->setModified();
},
&m_updaters));
yFormLayout->addRow("Max:",
GUI::Util::createDoubleSpinBox(
[this] { return m_data_source->currentData1DItem()->axItemY()->max(); },
[this](double newValue) {
m_data_source->currentData1DItem()->for (auto* item : m_data_source->mainData1DItems()) {
item->axItemY()->setMax(newValue);
item->axItemY()->adjustLogRangeOrders();
updateUIValues();
}
gDoc->setModified();
},
&m_updaters));
yFormLayout->addRow(GUI::Util::createCheckBox(
"log10", [this] { return m_data_source->currentData1DItem()->axItemY()->isLogScale(); },
[this, logRangeSpinBox](bool b) {
logRangeSpinBox->setEnabled(b);
for (auto* item : m_data_source->allData1DItems())
item->axItemY()->setLogScale(b);
gDoc->setModified();
},
&m_updaters));
yFormLayout->addRow("Log range:", logRangeSpinBox);
main_layout->addRow(yGroup);
updateUIValues();
// react on external changes (e.g. zooming in customplot shall update the axis values)
connect(m_data_source->currentData1DItem(), &DataItem::itemAxesRangeChanged, this,
&AxisPanel::updateUIValues, Qt::UniqueConnection);
// update coordinates on axes units change
for (auto* item : m_data_source->allData1DItems())
connect(item, &DataItem::axesUnitsChanged, this, &AxisPanel::updateItemCoords,
Qt::UniqueConnection);
}
AxisPanel::~AxisPanel() = default;
void AxisPanel::updateItemCoords(DataItem* item)
{
if (!item)
return;
emit item->axesUnitsReplotRequested();
updateUIValues();
}
void AxisPanel::updateUIValues()
{
for (const auto& updater : m_updaters)
updater();
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment