improved/fixed styling system: axis styles for colorbars were not properly taken from style objects + corrected some inaccurate drawing by using QRectF instead of QRect

This commit is contained in:
jkriege2 2022-05-23 22:41:57 +02:00
parent 667ffeb3f3
commit b756cb91e6
10 changed files with 127 additions and 117 deletions

View File

@ -777,8 +777,8 @@ void JKQTPMathImage::setParent(JKQTBasePlotter* parent) {
if (parent) {
parent->registerAdditionalAction(tr("Save Image Plot Images ..."), actSaveImage);
parent->registerAdditionalAction(tr("Copy Image Plot Images ..."), actCopyImage);
parent->registerAdditionalAction(tr("Save Image Plot Images ..."), actSavePalette);
parent->registerAdditionalAction(tr("Copy Image Plot Images ..."), actCopyPalette);
parent->registerAdditionalAction(tr("Save Image Plot Palettes ..."), actSavePalette);
parent->registerAdditionalAction(tr("Copy Image Plot Palettes ..."), actCopyPalette);
}
actSaveImage->setEnabled(parent);
actCopyImage->setEnabled(parent);
@ -860,7 +860,7 @@ void JKQTPMathImage::saveColorbarPlotAsImage(const QString &filename, const QByt
QString selFormat;
if (fn.isEmpty()) {
selFormat=currentFileFormat;
fn = QFileDialog::getSaveFileName(nullptr, tr("Save Image Plot As Image ..."),
fn = QFileDialog::getSaveFileName(nullptr, tr("Save Palette Plot As Image ..."),
currentSaveDirectory,
filt.join(";;"), &selFormat);
if (!fn.isEmpty()) currentSaveDirectory=QFileInfo(fn).absolutePath();
@ -905,12 +905,12 @@ void JKQTPMathImage::draw(JKQTPEnhancedPainter& painter) {
void JKQTPMathImage::getOutsideSize(JKQTPEnhancedPainter& painter, int& leftSpace, int& rightSpace, int& topSpace, int& bottomSpace) {
JKQTPGraph::getOutsideSize(painter, leftSpace, rightSpace, topSpace, bottomSpace);
JKQTPMathImageBase::getOutsideSize(painter, leftSpace, rightSpace, topSpace, bottomSpace);
cbGetOutsideSize(painter, leftSpace, rightSpace, topSpace, bottomSpace);
}
void JKQTPMathImage::drawOutside(JKQTPEnhancedPainter& painter, QRect leftSpace, QRect rightSpace, QRect topSpace, QRect bottomSpace) {
JKQTPGraph::drawOutside(painter, leftSpace, rightSpace, topSpace, bottomSpace);
JKQTPMathImageBase::drawOutside(painter, leftSpace, rightSpace, topSpace, bottomSpace);
if (showColorBar) cbDrawOutside(painter, leftSpace, rightSpace, topSpace, bottomSpace);
}

View File

@ -42,61 +42,19 @@ void JKQTPRGBMathImage::initObject()
rgbMode=JKQTPRGBMathImageModeRGBMode;
colorBarRightAxis=new JKQTPVerticalIndependentAxis(0, 100, 0, 100, parent);
colorBarRightAxis->setDrawMode1(JKQTPCADMLine);
colorBarRightAxis->setDrawMode2(JKQTPCADMcomplete);
colorBarRightAxis->setAxisLabel("");
colorBarRightAxis->setMinTicks(5);
colorBarRightAxis->setMinorTicks(0);
colorBarRightAxis->setTickOutsideLength(0);
colorBarRightAxis->setMinorTickOutsideLength(0);
colorBarRightAxis->setShowZeroAxis(false);
colorBarTopAxis=new JKQTPHorizontalIndependentAxis(0, 100, 0, 100, parent);
colorBarTopAxis->setDrawMode1(JKQTPCADMLine);
colorBarTopAxis->setDrawMode2(JKQTPCADMcomplete);
colorBarTopAxis->setAxisLabel("");
colorBarTopAxis->setMinTicks(3);
colorBarTopAxis->setMinorTicks(0);
colorBarTopAxis->setTickOutsideLength(0);
colorBarTopAxis->setMinorTickOutsideLength(0);
colorBarTopAxis->setShowZeroAxis(false);
colorBarRightAxisG=new JKQTPVerticalIndependentAxis(0, 100, 0, 100, parent);
colorBarRightAxisG->setDrawMode1(JKQTPCADMLine);
colorBarRightAxisG->setDrawMode2(JKQTPCADMcomplete);
colorBarRightAxisG->setAxisLabel("");
colorBarRightAxisG->setMinTicks(5);
colorBarRightAxisG->setShowZeroAxis(false);
colorBarRightAxisG->setMinorTicks(0);
colorBarRightAxisG->setTickOutsideLength(0);
colorBarRightAxisG->setMinorTickOutsideLength(0);
colorBarTopAxisG=new JKQTPHorizontalIndependentAxis(0, 100, 0, 100, parent);
colorBarTopAxisG->setDrawMode1(JKQTPCADMLine);
colorBarTopAxisG->setDrawMode2(JKQTPCADMcomplete);
colorBarTopAxisG->setAxisLabel("");
colorBarTopAxisG->setMinTicks(3);
colorBarTopAxisG->setShowZeroAxis(false);
colorBarTopAxisG->setMinorTicks(0);
colorBarTopAxisG->setTickOutsideLength(0);
colorBarTopAxisG->setMinorTickOutsideLength(0);
colorBarRightAxisB=new JKQTPVerticalIndependentAxis(0, 100, 0, 100, parent);
colorBarRightAxisB->setDrawMode1(JKQTPCADMLine);
colorBarRightAxisB->setDrawMode2(JKQTPCADMcomplete);
colorBarRightAxisB->setAxisLabel("");
colorBarRightAxisB->setMinTicks(5);
colorBarRightAxisB->setShowZeroAxis(false);
colorBarRightAxisB->setMinorTicks(0);
colorBarRightAxisB->setTickOutsideLength(0);
colorBarRightAxisB->setMinorTickOutsideLength(0);
colorBarTopAxisB=new JKQTPHorizontalIndependentAxis(0, 100, 0, 100, parent);
colorBarTopAxisB->setDrawMode1(JKQTPCADMLine);
colorBarTopAxisB->setDrawMode2(JKQTPCADMcomplete);
colorBarTopAxisB->setAxisLabel("");
colorBarTopAxisB->setMinTicks(3);
colorBarTopAxisB->setShowZeroAxis(false);
colorBarTopAxisB->setMinorTicks(0);
colorBarTopAxisB->setTickOutsideLength(0);
colorBarTopAxisB->setMinorTickOutsideLength(0);
this->colorBarTopVisible=true;

View File

@ -148,9 +148,9 @@ class JKQTPLOTTER_LIB_EXPORT JKQTBasePlotterStyle {
/** \brief style of the y-axis of the main coordinate system */
JKQTPCoordinateAxisStyle yAxisStyle;
/** \brief style of the coordinate axes used to display colorbars in the right */
JKQTPCoordinateAxisStyle rightColorbarAxisStyle;
JKQTPColorbarCoordinateAxisStyle rightColorbarAxisStyle;
/** \brief style of the coordinate axes used to display colorbars at the top */
JKQTPCoordinateAxisStyle topColorbarAxisStyle;
JKQTPColorbarCoordinateAxisStyle topColorbarAxisStyle;
/** \brief style of the graphs */
JKQTGraphsBaseStyle graphsStyle;

View File

@ -1327,6 +1327,12 @@ void JKQTPVerticalAxis::drawAxes(JKQTPEnhancedPainter& painter) {
//qDebug()<<" offset="<<offset;
//qDebug()<<" x2p(0)="<<x2p(0);
//qDebug()<<" tickStart="<<tickStart;
//qDebug()<<" drawMode1="<<JKQTPCADrawMode2String(axisStyle.drawMode1);
//qDebug()<<" drawMode2="<<JKQTPCADrawMode2String(axisStyle.drawMode2);
//qDebug()<<" tickInsideLength="<<axisStyle.tickInsideLength;
//qDebug()<<" tickOutsideLength="<<axisStyle.tickOutsideLength;
//qDebug()<<" minorTickInsideLength="<<axisStyle.minorTickInsideLength;
//qDebug()<<" minorTickOutsideLength="<<axisStyle.minorTickOutsideLength;
if (std::isnan(left) || std::isnan(right) || std::isnan(top) || std::isnan(bottom)) return;
if (std::isinf(left) || std::isinf(right) || std::isinf(top) || std::isinf(bottom)) return;
@ -1397,13 +1403,14 @@ void JKQTPVerticalAxis::drawAxes(JKQTPEnhancedPainter& painter) {
double xleft=-1000000;
double xx=x2p(x);
//qDebug()<<" tick @ x="<<x<<" label="<<label<<" mtdist="<<mtdist<<" axisStyle.minorTicks="<<minorTicks;
//qDebug()<<" tick @ x="<<x<<" label="<<label<<" mtdist="<<mtdist;
if (JKQTPCADrawModeHasTicks(axisStyle.drawMode1)||JKQTPCADrawModeHasTickLabels(axisStyle.drawMode1)) {
//painter.setPen(ptick);
if ((x<=axismax) && (x>=axismin)) {
QLineF l(left-parent->pt2px(painter, axisStyle.tickOutsideLength), xx, left+parent->pt2px(painter, axisStyle.tickInsideLength), xx);
if (l.length()>0) lines_ptick.append(l);//painter.drawLine(l);
//qDebug()<<"tick: "<<l;
}
//painter.setPen(pmtick);
if ((tickLabels.size()<=0) && (axisStyle.minorTicks>0)) {
@ -1424,6 +1431,7 @@ void JKQTPVerticalAxis::drawAxes(JKQTPEnhancedPainter& painter) {
if (mx<=axismax && mx>=axismin) {
QLineF l(xleft=left-parent->pt2px(painter, axisStyle.minorTickOutsideLength), mxx, left+parent->pt2px(painter, axisStyle.minorTickInsideLength), mxx);
if (l.length()>0) lines_pmtick.append(l);//painter.drawLine(l);
//qDebug()<<"minortick: "<<l;
double val= mx/pow(logAxisBase,floor(log(mx)/log(logAxisBase)));
if (axisStyle.minorTickLabelsEnabled&&JKQTPCADrawModeHasTickLabels(axisStyle.drawMode1)) {
@ -1443,6 +1451,8 @@ void JKQTPVerticalAxis::drawAxes(JKQTPEnhancedPainter& painter) {
if (x<=axismax && x>=axismin) {
QLineF l(right-parent->pt2px(painter, axisStyle.tickInsideLength), xx, right+parent->pt2px(painter, axisStyle.tickOutsideLength), xx);
if (l.length()>0) lines_ptick2.append(l);//painter.drawLine(l);
//qDebug()<<"tick2: "<<l;
}
//painter.setPen(pmtick);
if ((tickLabels.size()<=0) && (axisStyle.minorTicks>0)) {
@ -1462,6 +1472,8 @@ void JKQTPVerticalAxis::drawAxes(JKQTPEnhancedPainter& painter) {
if (mx<=axismax && mx>=axismin) {
QLineF l(right-parent->pt2px(painter, axisStyle.minorTickInsideLength), mxx, xleft=(right+parent->pt2px(painter, axisStyle.minorTickOutsideLength)), mxx);
if (l.length()>0) lines_pmtick2.append(l);//painter.drawLine(l);
//qDebug()<<"minortick2: "<<l;
double val= mx/pow(logAxisBase,floor(log(mx)/log(logAxisBase)));
if (axisStyle.minorTickLabelsEnabled) {
@ -1497,6 +1509,13 @@ void JKQTPVerticalAxis::drawAxes(JKQTPEnhancedPainter& painter) {
painter.setPen(pmtick);
painter.drawLines(lines_pmtick);
painter.drawLines(lines_pmtick2);
//qDebug()<<"left="<<left<<", right="<<right<<", top="<<top<<", bottom="<<bottom;
//qDebug()<<"ptick: "<<jkqtp_QColor2String(ptick.color())<<","<<jkqtp_QPenStyle2String(ptick.style())<<" lines_ptick.size="<<lines_ptick.size()<<", lines_ptick2.size="<<lines_ptick2.size();
//if (lines_ptick.size()>0) qDebug()<<" lines_ptick[0]="<<lines_ptick[0];
//if (lines_ptick2.size()>0) qDebug()<<" lines_ptick2[0]="<<lines_ptick2[0];
//qDebug()<<"pmtick: "<<jkqtp_QColor2String(pmtick.color())<<","<<jkqtp_QPenStyle2String(pmtick.style())<<" lines_pmtick.size="<<lines_pmtick.size()<<", lines_pmtick2.size="<<lines_pmtick2.size();
//if (lines_pmtick.size()>0) qDebug()<<" lines_pmtick[0]="<<lines_pmtick[0];
//if (lines_pmtick2.size()>0) qDebug()<<" lines_pmtick2[0]="<<lines_pmtick2[0];
}
// plot axis label

View File

@ -150,3 +150,26 @@ void JKQTPCoordinateAxisStyle::saveSettings(QSettings &settings, const QString &
minorGridStyle.saveSettings(settings, group+"minor_grid/");
}
JKQTPColorbarCoordinateAxisStyle::JKQTPColorbarCoordinateAxisStyle():
JKQTPCoordinateAxisStyle()
{
initMembersForColorbars();
}
JKQTPColorbarCoordinateAxisStyle::JKQTPColorbarCoordinateAxisStyle(const JKQTBasePlotterStyle &baseStyle):
JKQTPCoordinateAxisStyle(baseStyle)
{
initMembersForColorbars();
}
void JKQTPColorbarCoordinateAxisStyle::initMembersForColorbars() {
drawMode1=JKQTPCADMLine;
drawMode2=JKQTPCADMcomplete;
minTicks=5;
minorTicks=0;
tickOutsideLength=0;
minorTickOutsideLength=0;
showZeroAxis=false;
}

View File

@ -185,4 +185,27 @@ class JKQTPLOTTER_LIB_EXPORT JKQTPCoordinateAxisStyle {
double axisLineOffset;
};
/** \brief Support Class for JKQTPCoordinateAxis, which summarizes all properties that define the visual styling of a JKQTPCoordinateAxis
* used for colorbars outside the plot
* \ingroup jkqtpplotter_styling
*
* The major difference between this dervied version and the base JKQTPCoordinateAxisStyle are differently initialized members.
* \see JKQTPCoordinateAxis, \ref jkqtpplotter_styling
*
*/
class JKQTPLOTTER_LIB_EXPORT JKQTPColorbarCoordinateAxisStyle: public JKQTPCoordinateAxisStyle {
Q_GADGET
public:
/** \copydoc JKQTPCoordinateAxisStyle::JKQTPCoordinateAxisStyle() */
JKQTPColorbarCoordinateAxisStyle();
/** \copydoc JKQTPCoordinateAxisStyle::JKQTPCoordinateAxisStyle(const JKQTBasePlotterStyle&) */
JKQTPColorbarCoordinateAxisStyle(const JKQTBasePlotterStyle& baseStyle);
private:
/** \brief modifies the members to match the requirements of colorbar axes */
void initMembersForColorbars();
};
#endif // JKQTPCOORDINATEAXESSTYLE_H

View File

@ -38,23 +38,9 @@ JKQTPColorPaletteStyleAndToolsMixin::JKQTPColorPaletteStyleAndToolsMixin(JKQTBas
{
cbParent=parent;
colorBarRightAxis=new JKQTPVerticalIndependentAxis(0, 100, 0, 100, parent);
colorBarRightAxis->setDrawMode1(JKQTPCADMLine);
colorBarRightAxis->setDrawMode2(JKQTPCADMcomplete);
colorBarRightAxis->setAxisLabel("");
colorBarRightAxis->setMinTicks(3);
colorBarRightAxis->setShowZeroAxis(false);
colorBarRightAxis->setMinorTicks(0);
colorBarRightAxis->setTickOutsideLength(0);
colorBarRightAxis->setMinorTickOutsideLength(0);
colorBarTopAxis=new JKQTPHorizontalIndependentAxis(0, 100, 0, 100, parent);
colorBarTopAxis->setDrawMode1(JKQTPCADMLine);
colorBarTopAxis->setDrawMode2(JKQTPCADMcomplete);
colorBarTopAxis->setAxisLabel("");
colorBarTopAxis->setMinTicks(3);
colorBarTopAxis->setShowZeroAxis(false);
colorBarTopAxis->setMinorTicks(0);
colorBarTopAxis->setTickOutsideLength(0);
colorBarTopAxis->setMinorTickOutsideLength(0);
this->palette=JKQTPMathImageMATLAB;
@ -147,13 +133,11 @@ void JKQTPColorPaletteStyleAndToolsMixin::cbDrawOutside(JKQTPEnhancedPainter& pa
//qDebug()<<"r: "<<imageName<<rightSpace;
QRect cb(static_cast<int>(rightSpace.x()+cbParent->pt2px(painter, colorBarOffset)), rightSpace.top()+(rightSpace.height()-barHeight)/2, static_cast<int>(cbParent->pt2px(painter, colorBarWidth)), barHeight);
QRectF cb(static_cast<int>(rightSpace.x()+cbParent->pt2px(painter, colorBarOffset)), rightSpace.top()+(rightSpace.height()-barHeight)/2, static_cast<int>(cbParent->pt2px(painter, colorBarWidth)), barHeight);
painter.drawImage(cb, b.mirrored(true, false));
QPen p=painter.pen();
p.setColor(colorBarRightAxis->getAxisColor());
p.setWidthF(qMax(JKQTPlotterDrawingTools::ABS_MIN_LINEWIDTH, cbParent->pt2px(painter, colorBarRightAxis->getLineWidth()*cbParent->getLineWidthMultiplier())));
painter.setPen(p);
painter.drawRect(cb);
colorBarRightAxis->setRange(internalDataMin, internalDataMax);
colorBarRightAxis->setAxisWidth(cb.height());
@ -162,12 +146,17 @@ void JKQTPColorPaletteStyleAndToolsMixin::cbDrawOutside(JKQTPEnhancedPainter& pa
colorBarRightAxis->setOtherAxisWidth(cb.width());
colorBarRightAxis->drawAxes(painter);
if ( JKQTPCADrawModeHasLine(colorBarRightAxis->getDrawMode1()) && JKQTPCADrawModeHasLine(colorBarRightAxis->getDrawMode2())) {
painter.setPen(p);
painter.drawLine(QLineF(cb.topLeft(), cb.topRight()));
painter.drawLine(QLineF(cb.bottomLeft(), cb.bottomRight()));
}
cbParent->getMathText()->setFontSize(imageNameFontSize*cbParent->getFontSizeMultiplier());
cbParent->getMathText()->setFontRomanOrSpecial(imageNameFontName);
cbParent->getMathText()->parse(imageName);
cbParent->getMathText()->draw(painter, Qt::AlignHCenter|Qt::AlignVCenter, QRect(rightSpace.x(), rightSpace.y(), rightSpace.width(), (rightSpace.height()-barHeight)/2));
cbParent->getMathText()->draw(painter, Qt::AlignHCenter|Qt::AlignVCenter, QRectF(rightSpace.x(), rightSpace.y(), rightSpace.width(), (rightSpace.height()-barHeight)/2));
}
@ -197,7 +186,7 @@ void JKQTPColorPaletteStyleAndToolsMixin::cbDrawOutside(JKQTPEnhancedPainter& pa
}
QRect cb(topSpace.x()+(topSpace.width()-barWidth)/2, static_cast<int>(topSpace.bottom()-cbParent->pt2px(painter, colorBarOffset+(colorBarWidth))), barWidth, static_cast<int>(cbParent->pt2px(painter, colorBarWidth)));
QRectF cb(topSpace.x()+(topSpace.width()-barWidth)/2, static_cast<int>(topSpace.bottom()-cbParent->pt2px(painter, colorBarOffset+(colorBarWidth))), barWidth, static_cast<int>(cbParent->pt2px(painter, colorBarWidth)));
//qDebug()<<"t: "<<imageName<<topSpace<<topSpace.bottom()<<colorBarOffset<<"\n "<<cb;
QTransform rm;
rm.rotate(90);
@ -206,7 +195,7 @@ void JKQTPColorPaletteStyleAndToolsMixin::cbDrawOutside(JKQTPEnhancedPainter& pa
p.setColor(colorBarTopAxis->getAxisColor());
p.setWidthF(qMax(JKQTPlotterDrawingTools::ABS_MIN_LINEWIDTH, cbParent->pt2px(painter, colorBarTopAxis->getLineWidth()*cbParent->getLineWidthMultiplier())));
painter.setPen(p);
painter.drawRect(cb);
//painter.drawRect(cb);
colorBarTopAxis->setRange(internalDataMin, internalDataMax);
@ -216,12 +205,17 @@ void JKQTPColorPaletteStyleAndToolsMixin::cbDrawOutside(JKQTPEnhancedPainter& pa
colorBarTopAxis->setOtherAxisWidth(cb.height());
colorBarTopAxis->drawAxes(painter);
if ( JKQTPCADrawModeHasLine(colorBarTopAxis->getDrawMode1()) && JKQTPCADrawModeHasLine(colorBarTopAxis->getDrawMode2())) {
painter.setPen(p);
painter.drawLine(QLineF(cb.topLeft(), cb.bottomLeft()));
painter.drawLine(QLineF(cb.topRight(), cb.bottomRight()));
}
cbParent->getMathText()->setFontSize(imageNameFontSize*cbParent->getFontSizeMultiplier());
cbParent->getMathText()->setFontRomanOrSpecial(imageNameFontName);
cbParent->getMathText()->parse(imageName);
cbParent->getMathText()->draw(painter, Qt::AlignHCenter|Qt::AlignVCenter, QRect(topSpace.right()-(topSpace.width()-barWidth)/2, topSpace.y(), (topSpace.width()-barWidth)/2, topSpace.height()));
cbParent->getMathText()->draw(painter, Qt::AlignHCenter|Qt::AlignVCenter, QRectF(topSpace.right()-(topSpace.width()-barWidth)/2, topSpace.y(), (topSpace.width()-barWidth)/2, topSpace.height()));
}
@ -241,7 +235,7 @@ int JKQTPColorPaletteStyleAndToolsMixin::getPalettesCount()
QIcon JKQTPColorPaletteStyleAndToolsMixin::getPaletteIcon(int i) {
QImage img=getPaletteImage(i, static_cast<size_t>(JKQTPImageTools::PALETTE_ICON_WIDTH));
QPixmap pix(JKQTPImageTools::PALETTE_ICON_WIDTH,8);
QRect r(0,0,JKQTPImageTools::PALETTE_ICON_WIDTH-1,7);
QRectF r(0,0,JKQTPImageTools::PALETTE_ICON_WIDTH-1,7);
QPainter p(&pix);
p.drawImage(r, img);
p.setPen(QPen(QColor("black")));
@ -275,7 +269,7 @@ QIcon JKQTPColorPaletteStyleAndToolsMixin::getPaletteKeyIcon(int i)
{
QImage img=getPaletteKeyImage(i, static_cast<size_t>(JKQTPImageTools::PALETTE_ICON_WIDTH), static_cast<size_t>(JKQTPImageTools::PALETTE_IMAGEICON_HEIGHT));
QPixmap pix(JKQTPImageTools::PALETTE_ICON_WIDTH,JKQTPImageTools::PALETTE_IMAGEICON_HEIGHT);
QRect r(0,0,JKQTPImageTools::PALETTE_ICON_WIDTH-1,JKQTPImageTools::PALETTE_IMAGEICON_HEIGHT-1);
QRectF r(0,0,JKQTPImageTools::PALETTE_ICON_WIDTH-1,JKQTPImageTools::PALETTE_IMAGEICON_HEIGHT-1);
QPainter p(&pix);
p.drawImage(r, img);
p.setPen(QPen(QColor("black")));
@ -542,23 +536,9 @@ JKQTPColorPaletteWithModifierStyleAndToolsMixin::JKQTPColorPaletteWithModifierSt
JKQTPColorPaletteStyleAndToolsMixin(parent)
{
modifierColorBarTopAxis=new JKQTPVerticalIndependentAxis(0, 100, 0, 100, parent);
modifierColorBarTopAxis->setDrawMode1(JKQTPCADMLine);
modifierColorBarTopAxis->setDrawMode2(JKQTPCADMcomplete);
modifierColorBarTopAxis->setAxisLabel("");
modifierColorBarTopAxis->setMinTicks(3);
modifierColorBarTopAxis->setShowZeroAxis(false);
modifierColorBarTopAxis->setMinorTicks(0);
modifierColorBarTopAxis->setTickOutsideLength(0);
modifierColorBarTopAxis->setMinorTickOutsideLength(0);
modifierColorBarRightAxis=new JKQTPHorizontalIndependentAxis (0, 100, 0, 100, parent);
modifierColorBarRightAxis->setDrawMode1(JKQTPCADMLine);
modifierColorBarRightAxis->setDrawMode2(JKQTPCADMcomplete);
modifierColorBarRightAxis->setAxisLabel("");
modifierColorBarRightAxis->setMinTicks(5);
modifierColorBarRightAxis->setShowZeroAxis(false);
modifierColorBarRightAxis->setMinorTicks(0);
modifierColorBarRightAxis->setTickOutsideLength(0);
modifierColorBarRightAxis->setMinorTickOutsideLength(0);
this->colorBarModifiedWidth=80;
modifierMode=JKQTPMathImageModifierMode::ModifyNone;
}
@ -652,19 +632,18 @@ void JKQTPColorPaletteWithModifierStyleAndToolsMixin::cbDrawOutside(JKQTPEnhance
//qDebug()<<"r: "<<imageName<<rightSpace;
QRect cb(static_cast<int>(rightSpace.x()+cbParent->pt2px(painter, colorBarOffset)), rightSpace.top()+(rightSpace.height()-barHeight)/2, static_cast<int>(cbParent->pt2px(painter, (modifierMode==JKQTPMathImageModifierMode::ModifyNone)?colorBarWidth:colorBarModifiedWidth)), barHeight);
QRectF cb(static_cast<int>(rightSpace.x()+cbParent->pt2px(painter, colorBarOffset)), rightSpace.top()+(rightSpace.height()-barHeight)/2, static_cast<int>(cbParent->pt2px(painter, (modifierMode==JKQTPMathImageModifierMode::ModifyNone)?colorBarWidth:colorBarModifiedWidth)), barHeight);
painter.drawImage(cb, b.mirrored(true, false));
QPen p=painter.pen();
p.setColor(colorBarRightAxis->getAxisColor());
p.setWidthF(qMax(JKQTPlotterDrawingTools::ABS_MIN_LINEWIDTH, cbParent->pt2px(painter, colorBarRightAxis->getLineWidth()*cbParent->getLineWidthMultiplier())));
painter.setPen(p);
painter.drawRect(cb);
colorBarRightAxis->setRange(internalDataMin, internalDataMax);
colorBarRightAxis->setAxisWidth(cb.height());
colorBarRightAxis->setAxisOffset(cb.top());
colorBarRightAxis->setOtherAxisOffset(cb.left());
colorBarRightAxis->setOtherAxisWidth(cb.width());
//qDebug()<<"=================================================================\ncolorBarRightAxis:";
colorBarRightAxis->drawAxes(painter);
if (modifierMode!=JKQTPMathImageModifierMode::ModifyNone) {
@ -674,12 +653,18 @@ void JKQTPColorPaletteWithModifierStyleAndToolsMixin::cbDrawOutside(JKQTPEnhance
modifierColorBarRightAxis->setOtherAxisOffset(cb.top());
modifierColorBarRightAxis->setOtherAxisWidth(cb.height());
modifierColorBarRightAxis->drawAxes(painter);
} else {
if ( JKQTPCADrawModeHasLine(colorBarRightAxis->getDrawMode1()) && JKQTPCADrawModeHasLine(colorBarRightAxis->getDrawMode2())) {
painter.setPen(p);
painter.drawLine(QLineF(cb.topLeft(), cb.topRight()));
painter.drawLine(QLineF(cb.bottomLeft(), cb.bottomRight()));
}
}
cbParent->getMathText()->setFontSize(imageNameFontSize*cbParent->getFontSizeMultiplier());
cbParent->getMathText()->setFontRomanOrSpecial(cbParent->getCurrentPlotterStyle().defaultFontName);
cbParent->getMathText()->parse(imageName);
cbParent->getMathText()->draw(painter, Qt::AlignHCenter|Qt::AlignVCenter, QRect(rightSpace.x(), rightSpace.y(), rightSpace.width(), (rightSpace.height()-barHeight)/2));
cbParent->getMathText()->draw(painter, Qt::AlignHCenter|Qt::AlignVCenter, QRectF(rightSpace.x(), rightSpace.y(), rightSpace.width(), (rightSpace.height()-barHeight)/2));
}
@ -697,7 +682,7 @@ void JKQTPColorPaletteWithModifierStyleAndToolsMixin::cbDrawOutside(JKQTPEnhance
}
QRect cb(topSpace.x()+(topSpace.width()-barWidth)/2, topSpace.bottom()-cbParent->pt2px(painter, colorBarOffset+((modifierMode==JKQTPMathImageModifierMode::ModifyNone)?colorBarWidth:colorBarModifiedWidth)), barWidth, cbParent->pt2px(painter, (modifierMode==JKQTPMathImageModifierMode::ModifyNone)?colorBarWidth:colorBarModifiedWidth));
QRectF cb(topSpace.x()+(topSpace.width()-barWidth)/2, topSpace.bottom()-cbParent->pt2px(painter, colorBarOffset+((modifierMode==JKQTPMathImageModifierMode::ModifyNone)?colorBarWidth:colorBarModifiedWidth)), barWidth, cbParent->pt2px(painter, (modifierMode==JKQTPMathImageModifierMode::ModifyNone)?colorBarWidth:colorBarModifiedWidth));
//qDebug()<<"t: "<<imageName<<topSpace<<topSpace.bottom()<<colorBarOffset<<"\n "<<cb;
QTransform rm;
rm.rotate(90);
@ -705,8 +690,6 @@ void JKQTPColorPaletteWithModifierStyleAndToolsMixin::cbDrawOutside(JKQTPEnhance
QPen p=painter.pen();
p.setColor(colorBarTopAxis->getAxisColor());
p.setWidthF(qMax(JKQTPlotterDrawingTools::ABS_MIN_LINEWIDTH, cbParent->pt2px(painter, colorBarTopAxis->getLineWidth()*cbParent->getLineWidthMultiplier())));
painter.setPen(p);
painter.drawRect(cb);
colorBarTopAxis->setRange(internalDataMin, internalDataMax);
@ -723,12 +706,18 @@ void JKQTPColorPaletteWithModifierStyleAndToolsMixin::cbDrawOutside(JKQTPEnhance
modifierColorBarTopAxis->setOtherAxisOffset(cb.left());
modifierColorBarTopAxis->setOtherAxisWidth(cb.width());
modifierColorBarTopAxis->drawAxes(painter);
} else {
if ( JKQTPCADrawModeHasLine(colorBarTopAxis->getDrawMode1()) && JKQTPCADrawModeHasLine(colorBarTopAxis->getDrawMode2())) {
painter.setPen(p);
painter.drawLine(QLineF(cb.topLeft(), cb.bottomLeft()));
painter.drawLine(QLineF(cb.topRight(), cb.bottomRight()));
}
}
cbParent->getMathText()->setFontSize(imageNameFontSize*cbParent->getFontSizeMultiplier());
cbParent->getMathText()->setFontRomanOrSpecial(cbParent->getCurrentPlotterStyle().defaultFontName);
cbParent->getMathText()->parse(imageName);
cbParent->getMathText()->draw(painter, Qt::AlignHCenter|Qt::AlignVCenter, QRect(topSpace.right()-(topSpace.width()-barWidth)/2, topSpace.y(), (topSpace.width()-barWidth)/2, topSpace.height()));
cbParent->getMathText()->draw(painter, Qt::AlignHCenter|Qt::AlignVCenter, QRectF(topSpace.right()-(topSpace.width()-barWidth)/2, topSpace.y(), (topSpace.width()-barWidth)/2, topSpace.height()));
}

View File

@ -45,11 +45,11 @@ axis_colorbar_right\grid\color=black
axis_colorbar_right\grid\width=0.5
axis_colorbar_right\minor_grid\color=black
axis_colorbar_right\minor_grid\width=0.25
axis_colorbar_right\minor_tick\inside_length=2
axis_colorbar_right\minor_tick\inside_length=0
axis_colorbar_right\minor_tick\label_font_size=7
axis_colorbar_right\minor_tick\outside_length=0
axis_colorbar_right\ticks\inside_length=4
axis_colorbar_right\ticks\outside_length=0
axis_colorbar_right\minor_tick\outside_length=2
axis_colorbar_right\ticks\inside_length=0
axis_colorbar_right\ticks\outside_length=4
axis_colorbar_right\ticks\width=1
axis_colorbar_right\zero_line\line_width=1
axis_colorbar_top\line_width=1
@ -57,11 +57,11 @@ axis_colorbar_top\grid\color=black
axis_colorbar_top\grid\width=0.5
axis_colorbar_top\minor_grid\color=black
axis_colorbar_top\minor_grid\width=0.25
axis_colorbar_top\minor_tick\inside_length=2
axis_colorbar_top\minor_tick\inside_length=0
axis_colorbar_top\minor_tick\label_font_size=7
axis_colorbar_top\minor_tick\outside_length=0
axis_colorbar_top\ticks\inside_length=4
axis_colorbar_top\ticks\outside_length=0
axis_colorbar_top\minor_tick\outside_length=2
axis_colorbar_top\ticks\inside_length=0
axis_colorbar_top\ticks\outside_length=4
axis_colorbar_top\ticks\width=1
axis_colorbar_top\zero_line\line_width=1
graphs\auto_styles\color0=black

View File

@ -156,8 +156,8 @@ axis_y\minor_grid\color=gray
axis_y\minor_grid\width=0.5
axis_y\minor_grid\style=dot
axis_colorbar_right\color=black
axis_colorbar_right\draw_mode1=all
axis_colorbar_right\draw_mode2=line+ticks
axis_colorbar_right\draw_mode1=line
axis_colorbar_right\draw_mode2=all
axis_colorbar_right\line_width=1.5
axis_colorbar_right\axis_lines_offset=0
axis_colorbar_right\min_ticks=5
@ -169,19 +169,19 @@ axis_colorbar_right\minor_tick\labels_enabled=false
axis_colorbar_right\minor_tick\inside_length=1.5
axis_colorbar_right\minor_tick\label_font_size=6.4
axis_colorbar_right\minor_tick\label_full_number=true
axis_colorbar_right\minor_tick\outside_length=1.5
axis_colorbar_right\minor_tick\outside_length=0
axis_colorbar_right\minor_tick\width=1
axis_colorbar_right\minor_tick\count=1
axis_colorbar_right\minor_tick\count=0
axis_colorbar_right\ticks\date_format=dd.MM.yyyy
axis_colorbar_right\ticks\datetime_format=dd.MM.yyyy HH:mm
axis_colorbar_right\ticks\inside_length=3
axis_colorbar_right\ticks\label_distance=3
axis_colorbar_right\ticks\label_font_size=8
axis_colorbar_right\ticks\mode=lin_or_power
axis_colorbar_right\ticks\outside_length=3
axis_colorbar_right\ticks\outside_length=0
axis_colorbar_right\ticks\time_format=HH:mm
axis_colorbar_right\ticks\width=1.5
axis_colorbar_right\zero_line\enabled=true
axis_colorbar_right\zero_line\enabled=false
axis_colorbar_right\zero_line\line_width=1.5
axis_colorbar_right\zero_line\color=black
axis_colorbar_right\zero_line\style=solid
@ -194,8 +194,8 @@ axis_colorbar_right\minor_grid\color=gray
axis_colorbar_right\minor_grid\width=0.5
axis_colorbar_right\minor_grid\style=dot
axis_colorbar_top\color=black
axis_colorbar_top\draw_mode1=all
axis_colorbar_top\draw_mode2=line+ticks
axis_colorbar_top\draw_mode1=line
axis_colorbar_top\draw_mode2=all
axis_colorbar_top\line_width=1.5
axis_colorbar_top\axis_lines_offset=0
axis_colorbar_top\min_ticks=5
@ -207,19 +207,19 @@ axis_colorbar_top\minor_tick\labels_enabled=false
axis_colorbar_top\minor_tick\inside_length=1.5
axis_colorbar_top\minor_tick\label_font_size=6.4
axis_colorbar_top\minor_tick\label_full_number=true
axis_colorbar_top\minor_tick\outside_length=1.5
axis_colorbar_top\minor_tick\outside_length=0
axis_colorbar_top\minor_tick\width=1
axis_colorbar_top\minor_tick\count=1
axis_colorbar_top\minor_tick\count=0
axis_colorbar_top\ticks\date_format=dd.MM.yyyy
axis_colorbar_top\ticks\datetime_format=dd.MM.yyyy HH:mm
axis_colorbar_top\ticks\inside_length=3
axis_colorbar_top\ticks\label_distance=3
axis_colorbar_top\ticks\label_font_size=8
axis_colorbar_top\ticks\mode=lin_or_power
axis_colorbar_top\ticks\outside_length=3
axis_colorbar_top\ticks\outside_length=0
axis_colorbar_top\ticks\time_format=HH:mm
axis_colorbar_top\ticks\width=1.5
axis_colorbar_top\zero_line\enabled=true
axis_colorbar_top\zero_line\enabled=false
axis_colorbar_top\zero_line\line_width=1.5
axis_colorbar_top\zero_line\color=black
axis_colorbar_top\zero_line\style=solid

View File

@ -25,5 +25,3 @@ axis_y\ticks\label_distance=5
axis_y\ticks\width=1
axis_y\zero_line\line_width=1
axis_y\zero_line\color=black
axis_colorbar_right\zero_line\color=black
axis_colorbar_top\zero_line\color=black