[go: up one dir, main page]

Adding rangeLock property

Hi Emanuel and thanks for providing QCustomplot. It is great, compact and effective!

I've posted a feature request on your forum (http://www.qcustomplot.com/index.php/support/forum/1169) and realized it was quite easy to implement, so I decided to set it up to see what you think.

Here is my problem: I'm deriving com plot class fromQCustomPlot here is an example: Screen_Shot_2016-10-06_at_20.02.20

As you can see there is a lot of comboboxes, checkbox, spinboxes and everytime one of those changes, I need to replot (not a big deal).

Sometimes I wanted to lock/change axes by hand, so I implemented a generic Preferences window (connected to rightclick over a plot) lke this:

Screen_Shot_2016-10-06_at_20.04.57

where I can change title/font and foreach axis its label/color/font/log/grid and the range I added the toolbutton on the right to make the ranges editable.

Once an axis is locked the new property (Q_PROPERTY(bool rangeLocked READ rangeLocked WRITE setRangeLocked)) will be set to true and will inhibit these methods:

void QCPAxis::setRange(const QCPRange &range)
void QCPAxis::setRange(double lower, double upper)
void QCPAxis::setRange(double position, double size, Qt::AlignmentFlag alignment)
void QCPAxis::setRangeLower(double lower)
void QCPAxis::setRangeUpper(double upper)
void QCPAxis::scaleRange(double factor, double center)

My whole code is here:

https://github.com/iltommi/neutrino

The classes I derived from QCustomPlot are here: https://github.com/iltommi/neutrino/blob/master/src/graphics/nCustomPlots.h https://github.com/iltommi/neutrino/blob/master/src/graphics/nCustomPlots.cpp with the UI: https://github.com/iltommi/neutrino/blob/master/UIs/nCustomPlot.ui

Have a nice day Tommaso

Merge request reports

Loading