JKQTPlotter trunk/v5.0.0
an extensive Qt5+Qt6 Plotter framework (including a feature-richt plotter widget, a speed-optimized, but limited variant and a LaTeX equation renderer!), written fully in C/C++ and without external dependencies
Loading...
Searching...
No Matches

Guard Class (RAII construct) for JKQTPlotter that disables replotting on construction and reenables it on destruction. More...

#include <jkqtplotter.h>

Collaboration diagram for JKQTPlotterUpdateGuard:
[legend]

Public Member Functions

 JKQTPlotterUpdateGuard (const JKQTPlotterUpdateGuard &)=delete
 JKQTPlotterUpdateGuard (JKQTPlotter *plot, bool forceRedraw=false)
 JKQTPlotterUpdateGuard (JKQTPlotterUpdateGuard &&other) noexcept
 ~JKQTPlotterUpdateGuard ()
JKQTPlotterUpdateGuardoperator= (const JKQTPlotterUpdateGuard &)=delete
JKQTPlotterUpdateGuardoperator= (JKQTPlotterUpdateGuard &&other) noexcept
void release (bool forceRedraw=false)
 release the lock, if forceRedraw equals true JKQTPlotter::redrawPlot() is called in any case, if it is false, JKQTPlotter::redrawPlot() is called only if JKQTPlotter::isPlotUpdateEnabled() was true on construction of the guard

Private Attributes

bool m_forceRedraw
bool m_oldEnabled
JKQTPlotterm_plot

Detailed Description

Guard Class (RAII construct) for JKQTPlotter that disables replotting on construction and reenables it on destruction.

This class can be used to forbid replotting (to improve performance) while setting up a plot. The redraw is called on destruction of the guard,i.e. typically when leaving the block that encapsulates the plot construction.

{
JKQTPlotterUpdateGuard guard(plotter);
// set up plot here, e.g.
plotter->setX();
plotter->setY(); ...
} // Block ends and immediate plot updates are reenabled. Also JKQTPlotter::redrawPlot() is called.
JKQTPlotterUpdateGuard(JKQTPlotter *plot, bool forceRedraw=false)
See also
JKQTPlotter::setPlotUpdateEnabled(), JKQTPlotter::redrawPlot()
JKQTPlotterUpdateGuard for a guard class coupling calls to setPlotUpdateEnabled() and redrawPlot() with the lifetime of a code block. See Performance Considerations when Setting up Plots for a detailed description.

Constructor & Destructor Documentation

◆ JKQTPlotterUpdateGuard() [1/3]

JKQTPlotterUpdateGuard::JKQTPlotterUpdateGuard ( JKQTPlotter * plot,
bool forceRedraw = false )

◆ ~JKQTPlotterUpdateGuard()

JKQTPlotterUpdateGuard::~JKQTPlotterUpdateGuard ( )

◆ JKQTPlotterUpdateGuard() [2/3]

JKQTPlotterUpdateGuard::JKQTPlotterUpdateGuard ( const JKQTPlotterUpdateGuard & )
delete

◆ JKQTPlotterUpdateGuard() [3/3]

JKQTPlotterUpdateGuard::JKQTPlotterUpdateGuard ( JKQTPlotterUpdateGuard && other)
noexcept

Member Function Documentation

◆ operator=() [1/2]

JKQTPlotterUpdateGuard & JKQTPlotterUpdateGuard::operator= ( const JKQTPlotterUpdateGuard & )
delete

◆ operator=() [2/2]

JKQTPlotterUpdateGuard & JKQTPlotterUpdateGuard::operator= ( JKQTPlotterUpdateGuard && other)
noexcept

◆ release()

void JKQTPlotterUpdateGuard::release ( bool forceRedraw = false)

release the lock, if forceRedraw equals true JKQTPlotter::redrawPlot() is called in any case, if it is false, JKQTPlotter::redrawPlot() is called only if JKQTPlotter::isPlotUpdateEnabled() was true on construction of the guard

Member Data Documentation

◆ m_forceRedraw

bool JKQTPlotterUpdateGuard::m_forceRedraw
private

◆ m_oldEnabled

bool JKQTPlotterUpdateGuard::m_oldEnabled
private

◆ m_plot

JKQTPlotter* JKQTPlotterUpdateGuard::m_plot
private

The documentation for this class was generated from the following file: