ChartDirector 7.1 (C++ Edition)

QChartViewer.isInViewPortChangedEvent


Usage

bool isInViewPortChangedEvent();

Description

Checks if the current code is executing in a ViewPortChanged event.

This is to help preventing "event looping" in complicated GUI designs in which multiple controls can update the viewport and indirectly update each others.

For example, suppose in a scrollable chart design, the x-axis can be scrolled by both a scroll bar control and a date/time picker control. That means both scroll bar and date/time picker events may update the viewport.

The following sequence of events may happen:

The above is potentially an infinite loop as the ViewPortChanged event will keep firing again and again. To avoid this, QChartViewer.updateViewPort will perform no action if it is called within ViewPortChanged event. So the last step above cannot actually trigger another ViewPortChanged event. This avoids the infinite loop.

Internally, QChartViewer.updateViewPort use this method to checks if it is called within a ViewPortChanged event, and ignores the request if it is already in the event. This method allows external code to also change behaviour in a ViewPortChanged event.

Arguments

None

Return Value

True if the current code is executing in a QChartViewer.viewPortChanged signal, otherwise false.