20 #include "qcustomplot.h"
38 throw std::runtime_error(
"AxisPlotController: axis is not initialized.");
39 m_axisConn = std::make_unique<QMetaObject::Connection>();
45 auto on_axis_range = [
this](
const QCPRange& newRange) {
48 item->set_range(newRange.lower, newRange.upper);
53 m_axis,
static_cast<void (QCPAxis::*)(
const QCPRange&)
>(&QCPAxis::rangeChanged),
65 m_axis->setRange(QCPRange(lower, upper));
115 if (
p_impl->m_blockUpdate)
125 p_impl->setAxisLogScaleFromItem();
127 p_impl->m_axis->parentPlot()->replot();
136 p_impl->setDisconnected();
static const std::string P_MAX
static const std::string P_MIN
void setOnPropertyChange(Callbacks::item_str_t f)
Sets callback to be notified on item's property change.
SessionItem * item() const
For necessary manipulations on unsubscription.
The main object representing an editable/displayable/serializable entity.
T property(const std::string &tag) const
Returns data stored in property item.
T * item(const std::string &tag) const
Returns first item under given tag casted to a specified type.
Represent text item on plot.
Item to represent viewport axis.
static const std::string P_IS_LOG
static const std::string P_TITLE
std::pair< double, double > range() const
Returns pair of lower, upper axis range.
Establishes communication between QCPAxis and ViewportAxisItem.
~ViewportAxisPlotController() override
void subscribe() override
ViewportAxisPlotController(QCPAxis *axis)
std::unique_ptr< AxesPlotControllerImpl > p_impl
void unsubscribe() override
For necessary manipulations on new item.
MVVM_VIEW_EXPORT void SetLogarithmicScale(QCPColorScale *axis, bool is_log_scale)
Switch axis to logarithmic scale mode.
materialitems.h Collection of materials to populate MaterialModel.
QString const & name(EShape k)
std::unique_ptr< AxisTitleController > m_titleController
~AxesPlotControllerImpl()
void updateLowerRange(const ViewportAxisItem *item)
void setAxisLogScaleFromItem()
Sets log scale from item.
void setDisconnected()
Disonnects QCustomPlot signals.
void setAxisRangeFromItem()
Sets axesRange from SessionItem.
ViewportAxisPlotController * m_self
std::unique_ptr< QMetaObject::Connection > m_axisConn
void setConnected()
Connects QCustomPlot signals with controller methods.
void init_axis()
Init axis from item and setup connections.
AxesPlotControllerImpl(ViewportAxisPlotController *controller, QCPAxis *axis)
void updateUpperRange(const ViewportAxisItem *item)