IMPROVED/FIXED outside space requirements for color bars. Text was sometime too close to the plot border.

This commit is contained in:
jkriege2 2024-02-02 14:03:16 +01:00
parent 946e472ce7
commit 55625a25ee
2 changed files with 4 additions and 2 deletions

View File

@ -60,6 +60,7 @@ Changes, compared to \ref page_whatsnew_V4_0_0 "v4.0.0" include:
<li>FIXED/IMPROVED issue <a href="https://github.com/jkriege2/JKQtPlotter/issues/100">#100: Add option to disable resize delay feature by setting the delay to zero</a> (thanks to <a href="https://github.com/fpalazzolo">user:fpalazzolo</a> for reporting)</li>
<li>FIXED/NEW: placement of plot-title (was not centerd in its box, but glued to the bottom) by adding a plotstyle parameter JKQTBasePlotterStyle::plotLabelOffset</li>
<li>FIXED/REWORKED issue <a href="https://github.com/jkriege2/JKQtPlotter/issues/111">#111: Can't write to PDF files with JKQTPlotter::saveImage() when passing a filename ending in ".pdf"</a> (thanks to <a href="https://github.com/fpalazzolo">user:fpalazzolo</a> for reporting):<br/>While fixing this issue, the functions JKQTBasePlotter::saveImage() etc. gained a bool return value to indicate whether sacing was successful.</li>
<li>IMPROVED/FIXED outside space requirements for color bars. Text was sometime too close to the plot border.</li>
<li>REWORKED JKQTBasePlotter::saveData() with a more consistent interface and a bool return value to indicate success or failure + improved documentation, added methods to JKQTPSaveDataAdapter that allow to specify file extensions and an ID for the plugin.</li>
<li>REORGANIZED: separated line-graphs from jkqtpscatter.h/.cpp into jkqtplines.h/.cpp</li>
<li>IMPROVED: QT6-compatibility by removing deprecated warnings</li>

View File

@ -558,10 +558,11 @@ void JKQTPColorPaletteWithModifierStyleAndToolsMixin::cbGetOutsideSize(JKQTPEnha
double internalDataMax=0;
double internalModifierMin=0;
double internalModifierMax=0;
const double axisSepPT=cbParent->getCurrentPlotterStyle().secondaryAxisSeparation;
cbGetDataMinMax(internalDataMin, internalDataMax);
cbGetModifierDataMinMax(internalDataMin, internalDataMax);
if (colorBarRightVisible) {
rightSpace+=cbParent->pt2px(painter, colorBarWidth+colorBarOffset);
rightSpace+=cbParent->pt2px(painter, colorBarWidth+colorBarOffset+axisSepPT);
colorBarRightAxis->setRange(internalDataMin, internalDataMax);
colorBarRightAxis->setAxisWidth(colorBarRelativeHeight*cbParent->getPlotHeight());
modifierColorBarRightAxis->setRange(internalModifierMin, internalModifierMax);
@ -583,7 +584,7 @@ void JKQTPColorPaletteWithModifierStyleAndToolsMixin::cbGetOutsideSize(JKQTPEnha
const auto s1=colorBarTopAxis->getSize2(painter);
const auto s2=colorBarTopAxis->getSize1(painter);
const QSizeF names=cbParent->getTextSizeSize(imageNameFontName, imageNameFontSize*cbParent->getFontSizeMultiplier(), imageName, painter);
topSpace+=cbParent->pt2px(painter, colorBarWidth+colorBarOffset)+qMax(static_cast<double>(s1.requiredSize+s2.requiredSize), static_cast<double>(names.height()));
topSpace+= cbParent->pt2px(painter, colorBarWidth+colorBarOffset+axisSepPT)+qMax(static_cast<double>(s1.requiredSize+s2.requiredSize), static_cast<double>(names.height()));
if (modifierMode!=JKQTPMathImageModifierMode::ModifyNone) {
topSpace=topSpace+static_cast<int>(2.0*cbParent->pt2px(painter, colorBarModifiedWidth-colorBarWidth));
}