From df7fc323a61d22e25d62fa048b6d6fc90aad5697 Mon Sep 17 00:00:00 2001 From: Patrick Avery Date: Sat, 25 Nov 2017 13:39:09 -0500 Subject: [PATCH] Allow plot axis width to be changed. This adds a function that allows the plot axis width to be changed. --- libavogadro/src/plotwidget.cpp | 16 ++++++++++++++-- libavogadro/src/plotwidget.h | 18 ++++++++++++------ 2 files changed, 26 insertions(+), 8 deletions(-) diff --git a/libavogadro/src/plotwidget.cpp b/libavogadro/src/plotwidget.cpp index 6766fc8b7..9e253e85e 100644 --- a/libavogadro/src/plotwidget.cpp +++ b/libavogadro/src/plotwidget.cpp @@ -61,7 +61,8 @@ namespace Avogadro { cBackground( Qt::black ), cForeground( Qt::white ), cGrid( Qt::gray ), showGrid( false ), showObjectToolTip( true ), useAntialias( false ), font( QFont() ), followingMouse(false), jailedInDefaults(false), - labelShiftDirection(None) + labelShiftDirection(None), + axisWidth(1) { // create the axes and setting their default properties PlotAxis *leftAxis = new PlotAxis(); @@ -131,6 +132,9 @@ namespace Avogadro { // Wether can move away default limits rectangle bool jailedInDefaults; Direction labelShiftDirection; + + // The width of the axes and tick markers. Default is 1. + int axisWidth; }; PlotWidget::PlotWidget( QWidget * parent ) @@ -542,6 +546,12 @@ namespace Avogadro { update(); } + void PlotWidget::setAxisWidth( int w ) + { + d->axisWidth = w; + update(); + } + void PlotWidget::setShowGrid( bool show ) { d->showGrid = show; update(); @@ -1533,7 +1543,9 @@ namespace Avogadro { } } - p->setPen( foregroundColor() ); + QPen pen(foregroundColor()); + pen.setWidth(d->axisWidth); + p->setPen(pen); p->setBrush( Qt::NoBrush ); /*** BottomAxis ***/ diff --git a/libavogadro/src/plotwidget.h b/libavogadro/src/plotwidget.h index b1141ed20..a179c5564 100644 --- a/libavogadro/src/plotwidget.h +++ b/libavogadro/src/plotwidget.h @@ -124,19 +124,19 @@ namespace Avogadro { RightAxis, ///< the right axis TopAxis ///< the top axis }; - + /** * The four directions for label shift. */ enum Direction { None = 0, - Left, ///< + Left, ///< Down, ///< - Right, ///< - Up ///< + Right, ///< + Up ///< }; - + /** *@return suggested minimum size for the plot widget */ @@ -373,6 +373,12 @@ namespace Avogadro { */ void setAntialiasing( bool b ); + /** + * Set the axis and tick marker widths. Default width is 1. + * @param w The width of the plot axes and tick markers. + */ + void setAxisWidth( int w ); + /** * @return the number of pixels to the left of the plot area. * @@ -606,7 +612,7 @@ namespace Avogadro { * @sa selectPoint() clearAndSelectPoint() selectPoints() clearAndSelectPoints() clearSelection() */ void setPointFollowMouse(bool b); - + /** * Don't permit moving away from default limits */