QCustomPlot Discussion and Comments

Multiple plots+scrollbars interactionReturn to overview

Hi, DerManu, —Āongrats with new site and release! :)

I'm working on coupling many plots with many scrollbars.
Using signal-slots from your example:

  connect(ui->verticalScrollBar, SIGNAL(valueChanged(int)), this, SLOT(vertScrollBarChanged(int)));
  connect(ui->plot->xAxis, SIGNAL(rangeChanged(QCPRange)), this, SLOT(xAxisChanged(QCPRange)));

Can you advice me, how better to send the pointer of relevant QCustomPlot* into the slot vertScrollBarChanged(int) and a pointer of relevant QScrollbar* into the slot xAxisChanged(QCPRange)?

When I worked with zoom/drag, I just used sender(), but it don't work here, cause here are two objects to tie somehow - plot and scrollbar.

In this case I think that a new widget class containing a QCustomPlot and two QScrollBars (possibly in a grid layout) would be the right approach. This way the widget can connect its plot with its scrollbars and provide (private) slots which do the range translation etc. Your main program then doesn't care about these details anymore and just uses the new widget.