mirror of
https://github.com/jkriege2/JKQtPlotter.git
synced 2024-11-15 10:05:47 +08:00
added debug-feature to show boxes around text in the plot
This commit is contained in:
parent
d3b74875db
commit
f33838f187
@ -23,6 +23,7 @@ Changes, compared to \ref page_whatsnew_V4_0_0 "v4.0.0" include:
|
||||
<li>NEW/BREAKING CHANGE: data tooltip can now also be shown when "just" moving the mouse (so far this was only possible when dragging the mouse with a button pressed). This also removes JKQtPlotter::getActMouseLeftAsToolTip() and adds JKQtPlotter::getActMouseMoveToolTip() instead! Also the default toolbars and context menus changed!</li>
|
||||
<li>NEW: new "seaborn" style for plots</li>
|
||||
<li>NEW/BREAKING CHANGE: changed JKQTPColorDerivationMode into a struct, which extends its capabilities above the previously available few enum-items</li>
|
||||
<li>NEW: added debug-feature to show boxes around text in the plot</li>
|
||||
</ul>
|
||||
|
||||
\subsection page_whatsnew_TRUNK_DOWNLOAD trunk: Download
|
||||
|
BIN
doc/images/debugShowRegionBoxes.png
Normal file
BIN
doc/images/debugShowRegionBoxes.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 74 KiB |
BIN
doc/images/debugShowTextBoxes.png
Normal file
BIN
doc/images/debugShowTextBoxes.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 16 KiB |
@ -31,6 +31,7 @@ TestStyling::TestStyling(QWidget *parent) :
|
||||
connect(ui->chkLogX, SIGNAL(toggled(bool)), ui->plot->getXAxis(), SLOT(setLogAxis(bool)));
|
||||
connect(ui->chkLogY, SIGNAL(toggled(bool)), ui->plot->getYAxis(), SLOT(setLogAxis(bool)));
|
||||
connect(ui->chkDebugBoxes, SIGNAL(toggled(bool)), ui->plot->getPlotter(), SLOT(enableDebugShowRegionBoxes(bool)));
|
||||
connect(ui->chkDebugTextBoxes, SIGNAL(toggled(bool)), ui->plot->getPlotter(), SLOT(enableDebugShowTextBoxes(bool)));
|
||||
|
||||
// store JKQTPlotter plotterStyle to a temporary INI-file
|
||||
// and then load that temporary file into the plainTextEdit,
|
||||
|
@ -40,7 +40,14 @@
|
||||
<item>
|
||||
<widget class="QCheckBox" name="chkDebugBoxes">
|
||||
<property name="text">
|
||||
<string>enabled</string>
|
||||
<string>regions</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="chkDebugTextBoxes">
|
||||
<property name="text">
|
||||
<string>text</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
|
@ -130,7 +130,7 @@ void JKQTPGeoText::draw(JKQTPEnhancedPainter& painter) {
|
||||
parent->getMathText()->setFontSize(getTextFontSize()*parent->getFontSizeMultiplier());
|
||||
parent->getMathText()->setFontColor(getTextColor());
|
||||
parent->getMathText()->parse(text);
|
||||
parent->getMathText()->draw(painter, transformX(x), transformY(y));
|
||||
parent->getMathText()->draw(painter, transformX(x), transformY(y), parent->getCurrentPlotterStyle().debugShowTextBoxes);
|
||||
|
||||
}
|
||||
|
||||
|
@ -1271,7 +1271,7 @@ void JKQTBasePlotter::drawPlot(JKQTPEnhancedPainter& painter) {
|
||||
double a=0,d=0,so=0,w=0;
|
||||
getTextSizeDetail(plotterStyle.plotLabelFontName,plotterStyle.plotLabelFontSize*fontSizeMultiplier,plotLabel, painter, w, a, d, so);
|
||||
QSizeF s=QSizeF(w, a+d);
|
||||
mathText.draw(painter, internalPlotBorderLeft+(internalPlotWidth-s.width())/2.0,plotterStyle.plotBorderTop+a*1.2);
|
||||
mathText.draw(painter, internalPlotBorderLeft+(internalPlotWidth-s.width())/2.0,plotterStyle.plotBorderTop+a*1.2, plotterStyle.debugShowTextBoxes);
|
||||
if (plotterStyle.debugShowRegionBoxes) {
|
||||
painter.save(); auto __finalpaint=JKQTPFinally([&painter]() {painter.restore();});
|
||||
QPen p("blue");
|
||||
@ -3134,11 +3134,24 @@ void JKQTBasePlotter::enableDebugShowRegionBoxes(bool enabled)
|
||||
}
|
||||
}
|
||||
|
||||
void JKQTBasePlotter::enableDebugShowTextBoxes(bool enabled)
|
||||
{
|
||||
if (plotterStyle.debugShowTextBoxes != enabled) {
|
||||
plotterStyle.debugShowTextBoxes = enabled;
|
||||
redrawPlot();
|
||||
}
|
||||
}
|
||||
|
||||
bool JKQTBasePlotter::isDebugShowRegionBoxesEnabled() const
|
||||
{
|
||||
return plotterStyle.debugShowRegionBoxes;
|
||||
}
|
||||
|
||||
bool JKQTBasePlotter::isDebugShowTextBoxesEnabled() const
|
||||
{
|
||||
return plotterStyle.debugShowTextBoxes;
|
||||
}
|
||||
|
||||
QString JKQTBasePlotter::getCSVcommentInitializer() const
|
||||
{
|
||||
return plotterStyle.CSVcommentInitializer;
|
||||
@ -4157,7 +4170,7 @@ void JKQTBasePlotter::drawKeyContents(JKQTPEnhancedPainter& painter, double x, d
|
||||
|
||||
mathText.parse(g->getTitle());
|
||||
QRectF txtRect(x+(plotterStyle.keyStyle.sampleLineLength+plotterStyle.keyStyle.xSeparation)*Xwid,y, key_text_width, itheight);
|
||||
mathText.draw(painter, Qt::AlignLeft|Qt::AlignVCenter, txtRect);
|
||||
mathText.draw(painter, Qt::AlignLeft|Qt::AlignVCenter, txtRect, plotterStyle.debugShowTextBoxes);
|
||||
//if (itheight<key_item_height*kfm.height()) itheight=key_item_height*kfm.height();
|
||||
//y=y+itheight+(plotterStyle.keyStyle.ySeparation)*kfm.height();
|
||||
y=y+key_text_height+(plotterStyle.keyStyle.ySeparation)*Xwid;
|
||||
@ -4195,7 +4208,7 @@ void JKQTBasePlotter::drawKeyContents(JKQTPEnhancedPainter& painter, double x, d
|
||||
|
||||
mathText.parse(g->getTitle());
|
||||
QRectF txtRect(x+(plotterStyle.keyStyle.sampleLineLength+plotterStyle.keyStyle.xSeparation)*Xwid,y, fs.width(), itheight);
|
||||
mathText.draw(painter, Qt::AlignLeft|Qt::AlignVCenter, txtRect);
|
||||
mathText.draw(painter, Qt::AlignLeft|Qt::AlignVCenter, txtRect, plotterStyle.debugShowTextBoxes);
|
||||
if (plotterStyle.debugShowRegionBoxes) {
|
||||
painter.save(); auto __finalpaintinner=JKQTPFinally([&painter]() {painter.restore();});
|
||||
QPen p("orange");
|
||||
@ -4243,7 +4256,7 @@ void JKQTBasePlotter::drawKeyContents(JKQTPEnhancedPainter& painter, double x, d
|
||||
mathText.parse(g->getTitle());
|
||||
//QSizeF fs=mt.getSize(painter);
|
||||
QRectF txtRect(xx+(plotterStyle.keyStyle.sampleLineLength+plotterStyle.keyStyle.xSeparation)*Xwid,yy, key_text_width, key_text_height);
|
||||
mathText.draw(painter, Qt::AlignLeft|Qt::AlignVCenter, txtRect);
|
||||
mathText.draw(painter, Qt::AlignLeft|Qt::AlignVCenter, txtRect, plotterStyle.debugShowTextBoxes);
|
||||
|
||||
if (plotterStyle.debugShowRegionBoxes) {
|
||||
painter.save(); auto __finalpaintinner=JKQTPFinally([&painter]() {painter.restore();});
|
||||
|
@ -736,10 +736,20 @@ class JKQTPLOTTER_LIB_EXPORT JKQTBasePlotter: public QObject {
|
||||
/** \copydoc JKQTBasePlotterStyle::defaultFontName */
|
||||
QString getDefaultTextFontName() const;
|
||||
/** \brief if set \c true (default: \c false ) the JKQTBasePlotter draws colored rectangles to indicate the different regions in the plot (border, axes, ...)
|
||||
*
|
||||
*
|
||||
* \image html debugShowRegionBoxes.png
|
||||
*
|
||||
* \see JKQTBasePlotterStyle::debugShowRegionBoxes, enableDebugShowRegionBoxes()
|
||||
*/
|
||||
bool isDebugShowRegionBoxesEnabled() const;
|
||||
/** \brief if set \c true (default: \c false ) the JKQTBasePlotter draws colored rectangles to indicate the extent of text
|
||||
*
|
||||
* \image html debugShowTextBoxes.png
|
||||
*
|
||||
* \see JKQTBasePlotterStyle::debugShowTextBoxes, enableDebugShowTextBoxes()
|
||||
*/
|
||||
bool isDebugShowTextBoxesEnabled() const;
|
||||
/** \copydoc JKQTBasePlotterStyle::plotFrameVisible */
|
||||
bool isPlotFrameVisible() const;
|
||||
/** \copydoc JKQTBasePlotterStyle::plotFrameColor */
|
||||
@ -1570,10 +1580,20 @@ class JKQTPLOTTER_LIB_EXPORT JKQTBasePlotter: public QObject {
|
||||
void setCSVcommentInitializer(const QString & __value);
|
||||
|
||||
/** \brief if set \c true (default: \c false ) the JKQTBasePlotter draws colored rectangles to indicate the different regions in the plot (border, axes, ...)
|
||||
*
|
||||
* \image html debugShowRegionBoxes.png
|
||||
*
|
||||
* \see JKQTBasePlotterStyle::debugShowRegionBoxes, isDebugShowRegionBoxesEnabled()
|
||||
*/
|
||||
void enableDebugShowRegionBoxes(bool enabled=true);
|
||||
|
||||
/** \brief if set \c true (default: \c false ) the JKQTBasePlotter draws colored rectangles to indicate the extent of text in the plot
|
||||
*
|
||||
* \image html debugShowTextBoxes.png
|
||||
*
|
||||
* \see JKQTBasePlotterStyle::debugShowTextBoxes, isDebugShowRegionTextEnabled()
|
||||
*/
|
||||
void enableDebugShowTextBoxes(bool enabled=true);
|
||||
protected:
|
||||
/** \brief this is a cache for JKQTBasePlotter::textSizeData calculated with JKQTBasePlotter::getTextSizeDetail() */
|
||||
static QHash<JKQTBasePlotter::textSizeKey, JKQTBasePlotter::textSizeData> s_TextSizeDataCache;
|
||||
|
@ -6,6 +6,8 @@
|
||||
JKQTBasePlotterStyle::JKQTBasePlotterStyle():
|
||||
debugShowRegionBoxes(false),
|
||||
debugRegionLineWidth(3),
|
||||
debugShowTextBoxes(false),
|
||||
debugTextBoxLineWidth(1),
|
||||
CSVdecimalSeparator("."),
|
||||
CSVcommentInitializer("# "),
|
||||
plotBorderTop(5),
|
||||
@ -45,6 +47,8 @@ void JKQTBasePlotterStyle::loadSettings(const QSettings &settings, const QString
|
||||
plotBorderBottom=settings.value(group+"plot_border_bottom", defaultStyle.plotBorderBottom).toInt();
|
||||
debugShowRegionBoxes=settings.value(group+"debug_show_region_boxes", defaultStyle.debugShowRegionBoxes).toBool();
|
||||
debugRegionLineWidth=settings.value(group+"debug_region_linewidth", defaultStyle.debugRegionLineWidth).toDouble();
|
||||
debugShowTextBoxes=settings.value(group+"debug_show_text_boxes", defaultStyle.debugShowTextBoxes).toBool();
|
||||
debugTextBoxLineWidth=settings.value(group+"debug_textbox_linewidth", defaultStyle.debugTextBoxLineWidth).toDouble();
|
||||
plotLabelFontName=settings.value(group+"plot_label_font_name", defaultStyle.plotLabelFontName).toString();
|
||||
plotLabelFontSize=settings.value(group+"plot_label_font_size", defaultStyle.plotLabelFontSize).toDouble();
|
||||
widgetBackgroundBrush=QBrush(jkqtp_String2QColor(settings.value(group+"widget_background_color", jkqtp_QColor2String(defaultStyle.widgetBackgroundBrush.color())).toString()));
|
||||
@ -77,6 +81,8 @@ void JKQTBasePlotterStyle::saveSettings(QSettings &settings, const QString &grou
|
||||
settings.setValue(group+"csv_comment_initializer", CSVcommentInitializer);
|
||||
settings.setValue(group+"debug_show_region_boxes", debugShowRegionBoxes);
|
||||
settings.setValue(group+"debug_region_linewidth", debugRegionLineWidth);
|
||||
settings.setValue(group+"debug_textbox_linewidth", debugShowTextBoxes);
|
||||
settings.setValue(group+"debug_region_linewidth", debugTextBoxLineWidth);
|
||||
settings.setValue(group+"antialiase_system", useAntiAliasingForSystem);
|
||||
settings.setValue(group+"antialiase_text", useAntiAliasingForText);
|
||||
settings.setValue(group+"widget_background_color", jkqtp_QColor2String(widgetBackgroundBrush.color()));
|
||||
|
@ -66,10 +66,22 @@ class JKQTPLOTTER_LIB_EXPORT JKQTBasePlotterStyle {
|
||||
*/
|
||||
void saveSettings(QSettings& settings, const QString& group=QString("plots/")) const;
|
||||
|
||||
/** \brief if set \c true (default: \c false ) the JKQTBasePlotter draws colored rectangles to indicate the different regions in the plot (border, axes, ...) */
|
||||
/** \brief if set \c true (default: \c false ) the JKQTBasePlotter draws colored rectangles to indicate the different regions in the plot (border, axes, ...)
|
||||
*
|
||||
* \image html debugShowRegionBoxes.png
|
||||
*
|
||||
*/
|
||||
bool debugShowRegionBoxes;
|
||||
/** \brief width of the lines that are drawn, when debugShowRegionBoxes \c ==true [in pixels] */
|
||||
double debugRegionLineWidth;
|
||||
/** \brief if set \c true (default: \c false ) the JKQTBasePlotter draws colored rectangles to indicate the outline etc. of text inside the plot
|
||||
*
|
||||
* \image html debugShowTextBoxes.png
|
||||
*
|
||||
*/
|
||||
bool debugShowTextBoxes;
|
||||
/** \brief width of the lines that are drawn, when debugShowTextBoxes \c ==true [in pixels] */
|
||||
double debugTextBoxLineWidth;
|
||||
|
||||
|
||||
/** \brief the decimal separator used when exporting data to text files */
|
||||
|
@ -1225,13 +1225,13 @@ void JKQTPVerticalAxis::drawTickLabel1(JKQTPEnhancedPainter &painter, double xx,
|
||||
painter.save(); auto __finalpaint=JKQTPFinally([&painter]() {painter.restore();});
|
||||
painter.translate(lx+width-1.25*strikeoutPos, yy-width/2.0);
|
||||
painter.rotate(axisStyle.tickLabelAngle);
|
||||
getParentMathText()->draw(painter, 0,0);
|
||||
getParentMathText()->draw(painter, 0,0, parent->getCurrentPlotterStyle().debugShowTextBoxes);
|
||||
|
||||
} else if (axisStyle.tickLabelAngle==-90) {
|
||||
painter.save(); auto __finalpaint=JKQTPFinally([&painter]() {painter.restore();});
|
||||
painter.translate(lx+width-0.25*strikeoutPos, yy+width/2.0);
|
||||
painter.rotate(axisStyle.tickLabelAngle);
|
||||
getParentMathText()->draw(painter, 0,0);
|
||||
getParentMathText()->draw(painter, 0,0, parent->getCurrentPlotterStyle().debugShowTextBoxes);
|
||||
|
||||
} else if (axisStyle.tickLabelAngle!=0) {
|
||||
painter.save(); auto __finalpaint=JKQTPFinally([&painter]() {painter.restore();});
|
||||
@ -1242,10 +1242,10 @@ void JKQTPVerticalAxis::drawTickLabel1(JKQTPEnhancedPainter &painter, double xx,
|
||||
painter.translate(lx+strikeoutPos+(width-strikeoutPos)*(1.0-cos(fabs(axisStyle.tickLabelAngle)/180.0*JKQTPSTATISTICS_PI)), yy+strikeoutPos+width*sin(fabs(axisStyle.tickLabelAngle)/180.0*JKQTPSTATISTICS_PI));
|
||||
painter.rotate(axisStyle.tickLabelAngle);
|
||||
}
|
||||
getParentMathText()->draw(painter, 0,0);
|
||||
getParentMathText()->draw(painter, 0,0, parent->getCurrentPlotterStyle().debugShowTextBoxes);
|
||||
|
||||
} else {
|
||||
getParentMathText()->draw(painter, lx, yy+strikeoutPos);
|
||||
getParentMathText()->draw(painter, lx, yy+strikeoutPos, parent->getCurrentPlotterStyle().debugShowTextBoxes);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1266,13 +1266,13 @@ void JKQTPVerticalAxis::drawTickLabel2(JKQTPEnhancedPainter &painter, double xx,
|
||||
painter.save(); auto __finalpaint=JKQTPFinally([&painter]() {painter.restore();});
|
||||
painter.translate(lx+descent, yy-width/2.0);
|
||||
painter.rotate(axisStyle.tickLabelAngle);
|
||||
getParentMathText()->draw(painter, 0,0);
|
||||
getParentMathText()->draw(painter, 0,0, parent->getCurrentPlotterStyle().debugShowTextBoxes);
|
||||
|
||||
} else if (axisStyle.tickLabelAngle==-90) {
|
||||
painter.save(); auto __finalpaint=JKQTPFinally([&painter]() {painter.restore();});
|
||||
painter.translate(lx+ascent, yy+width/2.0);
|
||||
painter.rotate(axisStyle.tickLabelAngle);
|
||||
getParentMathText()->draw(painter, 0,0);
|
||||
getParentMathText()->draw(painter, 0,0, parent->getCurrentPlotterStyle().debugShowTextBoxes);
|
||||
|
||||
} else if (axisStyle.tickLabelAngle!=0) {
|
||||
painter.save(); auto __finalpaint=JKQTPFinally([&painter]() {painter.restore();});
|
||||
@ -1284,10 +1284,10 @@ void JKQTPVerticalAxis::drawTickLabel2(JKQTPEnhancedPainter &painter, double xx,
|
||||
}
|
||||
painter.translate(lx+shiftx, yy+strikeoutPos);
|
||||
painter.rotate(-axisStyle.tickLabelAngle);
|
||||
getParentMathText()->draw(painter, 0,0);
|
||||
getParentMathText()->draw(painter, 0,0, parent->getCurrentPlotterStyle().debugShowTextBoxes);
|
||||
|
||||
} else {
|
||||
getParentMathText()->draw(painter, lx, yy+strikeoutPos);
|
||||
getParentMathText()->draw(painter, lx, yy+strikeoutPos, parent->getCurrentPlotterStyle().debugShowTextBoxes);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1539,13 +1539,13 @@ void JKQTPVerticalAxis::drawAxes(JKQTPEnhancedPainter& painter) {
|
||||
//painter.drawEllipse(-4, -4, 8, 8);
|
||||
switch(axisStyle.labelPosition) {
|
||||
case JKQTPLabelMax:
|
||||
getParentMathText()->draw(painter, Qt::AlignBottom|Qt::AlignRight, rect);
|
||||
getParentMathText()->draw(painter, Qt::AlignBottom|Qt::AlignRight, rect, parent->getCurrentPlotterStyle().debugShowTextBoxes);
|
||||
break;
|
||||
case JKQTPLabelMin:
|
||||
getParentMathText()->draw(painter, Qt::AlignBottom|Qt::AlignLeft, rect);
|
||||
getParentMathText()->draw(painter, Qt::AlignBottom|Qt::AlignLeft, rect, parent->getCurrentPlotterStyle().debugShowTextBoxes);
|
||||
break;
|
||||
case JKQTPLabelCenter:
|
||||
getParentMathText()->draw(painter, Qt::AlignBottom|Qt::AlignHCenter, rect);
|
||||
getParentMathText()->draw(painter, Qt::AlignBottom|Qt::AlignHCenter, rect, parent->getCurrentPlotterStyle().debugShowTextBoxes);
|
||||
break;
|
||||
}
|
||||
if (getParent()->getCurrentPlotterStyle().debugShowRegionBoxes) {
|
||||
@ -1579,13 +1579,13 @@ void JKQTPVerticalAxis::drawAxes(JKQTPEnhancedPainter& painter) {
|
||||
//painter.drawEllipse(-4, -4, 8, 8);
|
||||
switch(axisStyle.labelPosition) {
|
||||
case JKQTPLabelMax:
|
||||
getParentMathText()->draw(painter, Qt::AlignBottom|Qt::AlignRight, rect);
|
||||
getParentMathText()->draw(painter, Qt::AlignBottom|Qt::AlignRight, rect, parent->getCurrentPlotterStyle().debugShowTextBoxes);
|
||||
break;
|
||||
case JKQTPLabelMin:
|
||||
getParentMathText()->draw(painter, Qt::AlignBottom|Qt::AlignLeft, rect);
|
||||
getParentMathText()->draw(painter, Qt::AlignBottom|Qt::AlignLeft, rect, parent->getCurrentPlotterStyle().debugShowTextBoxes);
|
||||
break;
|
||||
case JKQTPLabelCenter:
|
||||
getParentMathText()->draw(painter, Qt::AlignBottom|Qt::AlignHCenter, rect);
|
||||
getParentMathText()->draw(painter, Qt::AlignBottom|Qt::AlignHCenter, rect, parent->getCurrentPlotterStyle().debugShowTextBoxes);
|
||||
break;
|
||||
}
|
||||
if (getParent()->getCurrentPlotterStyle().debugShowRegionBoxes) {
|
||||
@ -1864,10 +1864,10 @@ void JKQTPHorizontalAxis::drawTickLabel1(JKQTPEnhancedPainter &painter, double x
|
||||
painter.translate(xx+fabs(ascent*sin(fabs(axisStyle.tickLabelAngle)/180.0*JKQTPSTATISTICS_PI)/2.0)-width*fabs(cos(fabs(axisStyle.tickLabelAngle)/180.0*JKQTPSTATISTICS_PI)), lx0+ascent*fabs(cos(fabs(axisStyle.tickLabelAngle)/180.0*JKQTPSTATISTICS_PI))+fabs(width*sin(fabs(axisStyle.tickLabelAngle)/180.0*JKQTPSTATISTICS_PI)));
|
||||
painter.rotate(axisStyle.tickLabelAngle);
|
||||
}
|
||||
getParentMathText()->draw(painter, 0,0);
|
||||
getParentMathText()->draw(painter, 0,0, parent->getCurrentPlotterStyle().debugShowTextBoxes);
|
||||
|
||||
} else {
|
||||
getParentMathText()->draw(painter, xx-width/2.0, lx);
|
||||
getParentMathText()->draw(painter, xx-width/2.0, lx, parent->getCurrentPlotterStyle().debugShowTextBoxes);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1894,10 +1894,10 @@ void JKQTPHorizontalAxis::drawTickLabel2(JKQTPEnhancedPainter &painter, double x
|
||||
painter.translate(xx-fabs(descent*sin(fabs(axisStyle.tickLabelAngle)/180.0*JKQTPSTATISTICS_PI)/2.0)-width*fabs(cos(fabs(axisStyle.tickLabelAngle)/180.0*JKQTPSTATISTICS_PI)), lx0-descent*fabs(cos(fabs(axisStyle.tickLabelAngle)/180.0*JKQTPSTATISTICS_PI))-fabs(width*sin(fabs(axisStyle.tickLabelAngle)/180.0*JKQTPSTATISTICS_PI)));
|
||||
painter.rotate(-axisStyle.tickLabelAngle);
|
||||
}
|
||||
getParentMathText()->draw(painter, 0,0);
|
||||
getParentMathText()->draw(painter, 0,0, parent->getCurrentPlotterStyle().debugShowTextBoxes);
|
||||
|
||||
} else {
|
||||
getParentMathText()->draw(painter, xx-width/2.0, lx);
|
||||
getParentMathText()->draw(painter, xx-width/2.0, lx, parent->getCurrentPlotterStyle().debugShowTextBoxes);
|
||||
}
|
||||
|
||||
|
||||
@ -2135,13 +2135,13 @@ void JKQTPHorizontalAxis::drawAxes(JKQTPEnhancedPainter& painter) {
|
||||
//painter.drawEllipse(-4, -4, 8, 8);
|
||||
switch(axisStyle.labelPosition) {
|
||||
case JKQTPLabelMax:
|
||||
getParentMathText()->draw(painter, Qt::AlignBottom|Qt::AlignRight, rect);
|
||||
getParentMathText()->draw(painter, Qt::AlignBottom|Qt::AlignRight, rect, parent->getCurrentPlotterStyle().debugShowTextBoxes);
|
||||
break;
|
||||
case JKQTPLabelMin:
|
||||
getParentMathText()->draw(painter, Qt::AlignBottom|Qt::AlignLeft, rect);
|
||||
getParentMathText()->draw(painter, Qt::AlignBottom|Qt::AlignLeft, rect, parent->getCurrentPlotterStyle().debugShowTextBoxes);
|
||||
break;
|
||||
case JKQTPLabelCenter:
|
||||
getParentMathText()->draw(painter, Qt::AlignBottom|Qt::AlignHCenter, rect);
|
||||
getParentMathText()->draw(painter, Qt::AlignBottom|Qt::AlignHCenter, rect, parent->getCurrentPlotterStyle().debugShowTextBoxes);
|
||||
break;
|
||||
}
|
||||
if (getParent()->getCurrentPlotterStyle().debugShowRegionBoxes) {
|
||||
@ -2174,13 +2174,13 @@ void JKQTPHorizontalAxis::drawAxes(JKQTPEnhancedPainter& painter) {
|
||||
//painter.drawEllipse(-4, -4, 8, 8);
|
||||
switch(axisStyle.labelPosition) {
|
||||
case JKQTPLabelMax:
|
||||
getParentMathText()->draw(painter, Qt::AlignBottom|Qt::AlignRight, rect);
|
||||
getParentMathText()->draw(painter, Qt::AlignBottom|Qt::AlignRight, rect, parent->getCurrentPlotterStyle().debugShowTextBoxes);
|
||||
break;
|
||||
case JKQTPLabelMin:
|
||||
getParentMathText()->draw(painter, Qt::AlignBottom|Qt::AlignLeft, rect);
|
||||
getParentMathText()->draw(painter, Qt::AlignBottom|Qt::AlignLeft, rect, parent->getCurrentPlotterStyle().debugShowTextBoxes);
|
||||
break;
|
||||
case JKQTPLabelCenter:
|
||||
getParentMathText()->draw(painter, Qt::AlignBottom|Qt::AlignHCenter, rect);
|
||||
getParentMathText()->draw(painter, Qt::AlignBottom|Qt::AlignHCenter, rect, parent->getCurrentPlotterStyle().debugShowTextBoxes);
|
||||
break;
|
||||
}
|
||||
if (getParent()->getCurrentPlotterStyle().debugShowRegionBoxes) {
|
||||
|
@ -156,7 +156,7 @@ void JKQTPColorPaletteStyleAndToolsMixin::cbDrawOutside(JKQTPEnhancedPainter& pa
|
||||
cbParent->getMathText()->setFontSize(imageNameFontSize*cbParent->getFontSizeMultiplier());
|
||||
cbParent->getMathText()->setFontRomanOrSpecial(imageNameFontName);
|
||||
cbParent->getMathText()->parse(imageName);
|
||||
cbParent->getMathText()->draw(painter, Qt::AlignHCenter|Qt::AlignVCenter, QRectF(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), cbParent->getCurrentPlotterStyle().debugShowTextBoxes);
|
||||
|
||||
|
||||
}
|
||||
@ -215,7 +215,7 @@ void JKQTPColorPaletteStyleAndToolsMixin::cbDrawOutside(JKQTPEnhancedPainter& pa
|
||||
cbParent->getMathText()->setFontSize(imageNameFontSize*cbParent->getFontSizeMultiplier());
|
||||
cbParent->getMathText()->setFontRomanOrSpecial(imageNameFontName);
|
||||
cbParent->getMathText()->parse(imageName);
|
||||
cbParent->getMathText()->draw(painter, Qt::AlignHCenter|Qt::AlignVCenter, QRectF(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()), cbParent->getCurrentPlotterStyle().debugShowTextBoxes);
|
||||
|
||||
|
||||
}
|
||||
@ -664,7 +664,7 @@ void JKQTPColorPaletteWithModifierStyleAndToolsMixin::cbDrawOutside(JKQTPEnhance
|
||||
cbParent->getMathText()->setFontSize(imageNameFontSize*cbParent->getFontSizeMultiplier());
|
||||
cbParent->getMathText()->setFontRomanOrSpecial(cbParent->getCurrentPlotterStyle().defaultFontName);
|
||||
cbParent->getMathText()->parse(imageName);
|
||||
cbParent->getMathText()->draw(painter, Qt::AlignHCenter|Qt::AlignVCenter, QRectF(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), cbParent->getCurrentPlotterStyle().debugShowTextBoxes);
|
||||
|
||||
|
||||
}
|
||||
@ -717,7 +717,7 @@ void JKQTPColorPaletteWithModifierStyleAndToolsMixin::cbDrawOutside(JKQTPEnhance
|
||||
cbParent->getMathText()->setFontSize(imageNameFontSize*cbParent->getFontSizeMultiplier());
|
||||
cbParent->getMathText()->setFontRomanOrSpecial(cbParent->getCurrentPlotterStyle().defaultFontName);
|
||||
cbParent->getMathText()->parse(imageName);
|
||||
cbParent->getMathText()->draw(painter, Qt::AlignHCenter|Qt::AlignVCenter, QRectF(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()), cbParent->getCurrentPlotterStyle().debugShowTextBoxes);
|
||||
|
||||
|
||||
}
|
||||
|
@ -574,11 +574,11 @@ void JKQTPlotter::paintUserAction() {
|
||||
if (y1>y2) {
|
||||
QRectF rec((x1+x2)/2.0-w/2.0, y1+2, w, a+d);
|
||||
painter.fillRect(rec, plotterStyle.userActionOpaqueBrush);
|
||||
getPlotter()->getMathText()->draw(painter, Qt::AlignTop, rec);
|
||||
getPlotter()->getMathText()->draw(painter, Qt::AlignTop, rec, getPlotter()->getCurrentPlotterStyle().debugShowTextBoxes);
|
||||
} else {
|
||||
QRectF rec((x1+x2)/2.0-w/2.0, y1-2-a-d, w, a+d);
|
||||
painter.fillRect(rec, plotterStyle.userActionOpaqueBrush);
|
||||
getPlotter()->getMathText()->draw(painter, Qt::AlignBottom, rec);
|
||||
getPlotter()->getMathText()->draw(painter, Qt::AlignBottom, rec, getPlotter()->getCurrentPlotterStyle().debugShowTextBoxes);
|
||||
}
|
||||
|
||||
txt=jkqtp_floattolatexqstr(dy, 3);
|
||||
@ -588,11 +588,11 @@ void JKQTPlotter::paintUserAction() {
|
||||
if (x2>x1) {
|
||||
QRectF rec(x2+2, (y1+y2)/2.0-(a+d)/2.0, w, a+d);
|
||||
painter.fillRect(rec, plotterStyle.userActionOpaqueBrush);
|
||||
getPlotter()->getMathText()->draw(painter, Qt::AlignVCenter|Qt::AlignLeft, rec);
|
||||
getPlotter()->getMathText()->draw(painter, Qt::AlignVCenter|Qt::AlignLeft, rec, getPlotter()->getCurrentPlotterStyle().debugShowTextBoxes);
|
||||
} else {
|
||||
QRectF rec(x2-2-w, (y1+y2)/2.0-(a+d)/2.0, w, a+d);
|
||||
painter.fillRect(rec, plotterStyle.userActionOpaqueBrush);
|
||||
getPlotter()->getMathText()->draw(painter, Qt::AlignVCenter|Qt::AlignRight, rec);
|
||||
getPlotter()->getMathText()->draw(painter, Qt::AlignVCenter|Qt::AlignRight, rec, getPlotter()->getCurrentPlotterStyle().debugShowTextBoxes);
|
||||
}
|
||||
|
||||
|
||||
@ -602,11 +602,11 @@ void JKQTPlotter::paintUserAction() {
|
||||
if (x2<x1) {
|
||||
QRectF rec((x1+x2)/2.0, (y1+y2)/2.0-(a+d)/2.0, w, a+d);
|
||||
painter.fillRect(rec, plotterStyle.userActionOpaqueBrush);
|
||||
getPlotter()->getMathText()->draw(painter,Qt::AlignTop|Qt::AlignLeft, rec);
|
||||
getPlotter()->getMathText()->draw(painter,Qt::AlignTop|Qt::AlignLeft, rec, getPlotter()->getCurrentPlotterStyle().debugShowTextBoxes);
|
||||
} else {
|
||||
QRectF rec((x1+x2)/2.0-w, (y1+y2)/2.0-(a+d)/2.0, w, a+d);
|
||||
painter.fillRect(rec, plotterStyle.userActionOpaqueBrush);
|
||||
getPlotter()->getMathText()->draw(painter,Qt::AlignTop|Qt::AlignRight, rec);
|
||||
getPlotter()->getMathText()->draw(painter,Qt::AlignTop|Qt::AlignRight, rec, getPlotter()->getCurrentPlotterStyle().debugShowTextBoxes);
|
||||
}
|
||||
|
||||
|
||||
@ -691,7 +691,7 @@ void JKQTPlotter::paintUserAction() {
|
||||
JKQTPDrawTooltip(painter, mouseDragMarkers[0].pos.x(), mouseDragMarkers[0].pos.y(), rall);
|
||||
for (int i=0; i<txts.size(); i++) {
|
||||
getPlotter()->getMathText()->parse(txts[i]);
|
||||
getPlotter()->getMathText()->draw(painter, Qt::AlignTop|Qt::AlignLeft, rects[i]);
|
||||
getPlotter()->getMathText()->draw(painter, Qt::AlignTop|Qt::AlignLeft, rects[i], getPlotter()->getCurrentPlotterStyle().debugShowTextBoxes);
|
||||
QStringList el=getPlotter()->getMathText()->getErrorList();
|
||||
if (el.size()>0) {
|
||||
qDebug()<<"error parsing LaTeX string fo tooltip ("<<txts[i]<<"):\n - "<<el.join("\n - ");
|
||||
|
Loading…
Reference in New Issue
Block a user