diff --git a/doc/dox/whatsnew.dox b/doc/dox/whatsnew.dox
index 3ffc1d7928..f52b55979a 100644
--- a/doc/dox/whatsnew.dox
+++ b/doc/dox/whatsnew.dox
@@ -50,6 +50,7 @@ Changes, compared to \ref page_whatsnew_V4_0_0 "v4.0.0" include:
NEW: added JKQTPXYGraph::setKeyColumn()/JKQTPXYGraph::getKeyColumn() and JKQTPXYGraph::setValueColumn()/JKQTPXYGraph::getValueColumn() and corresponding functions in other classes. In most graph classes they point to xColumn for key and yColumn for values. These functions are virtual and overwritten in derived classes with horizontally oriented graphs, where they point to yColumn for key and yColumn for value. This way you can write generic code with classes for both orientations.
NEW: barcharts (derived from JKQTPBarGraphBase) can be configured to use different fill styles above and below the baseline, see JKQTPBarGraphBase::FillMode
NEW: added new error indicator styles JKQTPErrorHalfBarsOutwards, JKQTPErrorHalfBarsInwards, JKQTPErrorHalfBarsAbove, JKQTPErrorHalfBarsBelow which are especially useful for barcharts
+ NEW: Added signals JKQTBasePlotter::beforeExporting()/JKQTBasePlotter::afterExporting() and JKQTBasePlotterJKQTBasePlotter:beforePrinting()/JKQTBasePlotter::afterPrinting() which allow to modify the plot just before and just after an export/print
JKQTMathText:
diff --git a/lib/jkqtplotter/jkqtpbaseplotter.cpp b/lib/jkqtplotter/jkqtpbaseplotter.cpp
index c87f0c98ba..bef334b18f 100644
--- a/lib/jkqtplotter/jkqtpbaseplotter.cpp
+++ b/lib/jkqtplotter/jkqtpbaseplotter.cpp
@@ -1508,6 +1508,7 @@ void JKQTBasePlotter::print(QPrinter* printer, bool displayPreview) {
p->setPageOrientation(QPageLayout::Portrait);
}
+ emit beforeExporting();; auto __finalpaint=JKQTPFinally([&]() { emit afterExporting();});
printpreviewNew(p, false, -1.0, -1.0, displayPreview);
if (delP) delete p;
@@ -3646,6 +3647,7 @@ void JKQTBasePlotter::saveAsPDF(const QString& filename, bool displayPreview) {
}
if (!fn.isEmpty()) {
+ emit beforeExporting();; auto __finalpaint=JKQTPFinally([&]() { emit afterExporting();});
QPrinter* printer=new QPrinter;
bool doLandscape=widgetWidth>widgetHeight;
if (gridPrinting) {
@@ -3746,6 +3748,8 @@ void JKQTBasePlotter::saveImage(const QString& filename, bool displayPreview) {
}
+ emit beforeExporting();; auto __finalpaint=JKQTPFinally([&]() { emit afterExporting();});
+
gridPrintingCalc();
QPaintDevice* paintDevice=jkqtpPaintDeviceAdapters[adapterID]->createPaintdevice(fn, jkqtp_roundTo(gridPrintingSize.width()), jkqtp_roundTo(gridPrintingSize.height()));
@@ -3819,7 +3823,7 @@ void JKQTBasePlotter::saveAsPixelImage(const QString& filename, bool displayPrev
form="XPM";
}*/
-
+ emit beforeExporting();; auto __finalpaint=JKQTPFinally([&]() { emit afterExporting();});
gridPrintingCalc();
//std::cout<setResolution(96);
diff --git a/lib/jkqtplotter/jkqtpbaseplotter.h b/lib/jkqtplotter/jkqtpbaseplotter.h
index 6bddc945d9..e76dbbebcd 100644
--- a/lib/jkqtplotter/jkqtpbaseplotter.h
+++ b/lib/jkqtplotter/jkqtpbaseplotter.h
@@ -1112,6 +1112,38 @@ class JKQTPLOTTER_LIB_EXPORT JKQTBasePlotter: public QObject {
/** \brief emitted before the plot scaling has been recalculated */
void beforePlotScalingRecalculate();
+ /** \brief emitted just before exporting the current plot as image, or just before the export preview dialog is shown
+ *
+ * This signal can be used to e.g. modify the plotter settings before an export.
+ *
+ * \see afterExporting(), beforePrinting(), afterPrinting()
+ */
+ void beforeExporting();
+
+ /** \brief emitted just before exporting the current plot as image, or just before the export preview dialog is shown
+ *
+ * This signal can be used to e.g. modify the plotter settings after an export.
+ *
+ * \see beforeExporting(), beforePrinting(), afterPrinting()
+ */
+ void afterExporting();
+
+ /** \brief emitted just before Printing the current plot as image, or just before the print preview dialog is shown
+ *
+ * This signal can be used to e.g. modify the plotter settings before a print.
+ *
+ * \see afterPrinting(), beforeExporting(), afterExporting()
+ */
+ void beforePrinting();
+
+ /** \brief emitted just before Printing the current plot as image, or just before the print preview dialog is shown
+ *
+ * This signal can be used to e.g. modify the plotter settings after a print.
+ *
+ * \see beforePrinting(), beforeExporting(), afterExporting()
+ */
+ void afterPrinting();
+
public slots: