Skip to content

Commit

Permalink
Issue 730: Hook up new resize option to settingsform.
Browse files Browse the repository at this point in the history
  • Loading branch information
PMSeitzer committed Jun 18, 2024
1 parent 80a26b3 commit a267725
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 12 deletions.
4 changes: 2 additions & 2 deletions src/maven/eicwidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1292,8 +1292,8 @@ void EicWidget::addFocusLine(PeakGroup* group) {
void EicWidget::addAxes() {
//qDebug <<" EicWidget::addAxes()";
// qDebug() << "EicWidget: addAxes() " << _minY << " " << _maxY << endl;
Axes* x = new Axes(0,_minX, _maxX,10);
Axes* y = new Axes(1,_minY, _maxY,10);
Axes* x = new Axes(0,_minX, _maxX, 10, getMainWindow());
Axes* y = new Axes(1,_minY, _maxY, 10, getMainWindow());

x->setMargin(_xAxisPlotMargin);

Expand Down
7 changes: 5 additions & 2 deletions src/maven/plot_axes.cpp
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
#include "plot_axes.h"

Axes::Axes( int type, float min, float max, int nticks) {
Axes::Axes( int type, float min, float max, int nticks, MainWindow *mainwindow) {
this->type = type;
this->min = min;
this->max = max;
this->nticks = nticks;
this->mainwindow = mainwindow;
this->offset=0;
this->margin=0;
this->tickLinesFlag=false;
Expand All @@ -28,7 +29,9 @@ void Axes::paint(QPainter *painter, const QStyleOptionGraphicsItem *, QWidget *)
QPen pen(Qt::darkGray, 1, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin);
painter->setPen(pen);

double fontsize=12;
//Issue 730: retrieve this from settings
double fontsize = mainwindow->getSettings()->value("spnAxesTextSize", 12).toDouble();

QFont font("Helvetica",fontsize);
font.setBold(true);
painter->setFont(font);
Expand Down
5 changes: 3 additions & 2 deletions src/maven/plot_axes.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
#define PLOT_AXES_H

#include "stable.h"

#include "mainwindow.h"

class Axes : public QGraphicsItem
{
public:
Axes(QGraphicsItem* parent):QGraphicsItem(parent){}
Axes( int type, float min, float max, int nticks);
Axes( int type, float min, float max, int nticks, MainWindow *mainwindow);
QRectF boundingRect() const;
void setRange(double a, double b) { min=a; max=b; }
double getMin() {return min;}
Expand All @@ -32,6 +32,7 @@ class Axes : public QGraphicsItem
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget);

private:
MainWindow *mainwindow = nullptr;
int type;
float min;
float max;
Expand Down
12 changes: 6 additions & 6 deletions src/maven/spectrawidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1082,10 +1082,10 @@ void SpectraWidget::leaveEvent (QEvent*) {
}
*/

void SpectraWidget::addAxes() {
void SpectraWidget::addAxes() {

if (_drawXAxis ) {
Axes* x = new Axes(0,_minX, _maxX,10);
if (_drawXAxis ) {
Axes* x = new Axes(0,_minX, _maxX, 10, mainwindow);
scene()->addItem(x);
x->setZValue(998);
_items.push_back(x);
Expand All @@ -1099,7 +1099,7 @@ void SpectraWidget::addAxes() {
if (isCompoundAndScan) {

//scan y-axis
Axes* y = new Axes(1,_minY, _maxY, 5);
Axes* y = new Axes(1,_minY, _maxY, 5, mainwindow);

y->setRenderScale((_showOverlayScale));
y->setRenderOffset(_showOverlayOffset);
Expand All @@ -1112,7 +1112,7 @@ void SpectraWidget::addAxes() {
_items.push_back(y);

//overlay y-axis
Axes* yOverlay = new Axes(1, 0, 1.0, 5);
Axes* yOverlay = new Axes(1, 0, 1.0, 5, mainwindow);

yOverlay->setRenderScale(_showOverlayScale);

Expand All @@ -1127,7 +1127,7 @@ void SpectraWidget::addAxes() {

} else {

Axes* y = new Axes(1,_minY, _maxY, 5);
Axes* y = new Axes(1,_minY, _maxY, 5, mainwindow);
y->setZValue(999);
y->showTicLines(false);
y->setOffset(5);
Expand Down

0 comments on commit a267725

Please sign in to comment.