Skip to content

Commit

Permalink
Re #6477. Removed re-resizing of internal plot object in Graph.
Browse files Browse the repository at this point in the history
  • Loading branch information
mantid-roman committed Jan 30, 2013
1 parent b82991c commit e8d5e20
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 19 deletions.
17 changes: 1 addition & 16 deletions Code/Mantid/MantidPlot/src/Graph.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,6 @@ Graph::Graph(int x, int y, int width, int height, QWidget* parent, Qt::WFlags f)

connect (d_zoomer[0],SIGNAL(zoomed (const QwtDoubleRect &)),this,SLOT(zoomed (const QwtDoubleRect &)));

connect(this,SIGNAL(needReresize(QSize,QSize)),this,SLOT(reresize(QSize,QSize)),Qt::QueuedConnection);
}

void Graph::notifyChanges()
Expand Down Expand Up @@ -4218,26 +4217,12 @@ void Graph::resizeEvent ( QResizeEvent *e )
if (ignoreResize || !this->isVisible())
return;

if (autoScaleFonts){
// delayed resize of d_plot
emit needReresize(e->size(),e->oldSize());
} else {
if (!autoScaleFonts){
d_plot->resize(e->size());
d_plot->updateCurveLabels();
}
}

/**
* A slot which resizes d_plot. It is connected via queued connection to needReresize() signal
* emitted from resizeEvent(). It is done to avoid calling resize() inside resizeEvent()
* which can lead to infinite loops and other negative effects.
*/
void Graph::reresize(QSize newSize, QSize oldSize)
{
d_plot->resize(newSize);
scaleFonts((double)newSize.height()/(double)oldSize.height());
}

void Graph::scaleFonts(double factor)
{
QObjectList lst = d_plot->children();
Expand Down
3 changes: 0 additions & 3 deletions Code/Mantid/MantidPlot/src/Graph.h
Original file line number Diff line number Diff line change
Expand Up @@ -799,16 +799,13 @@ public slots:
void currentFontChanged(const QFont&);
void enableTextEditor(Graph *);
void curveRemoved();
void needReresize(QSize,QSize);

/// sent to indicate that scale type changed to log (bool arg is true) or to linear (boolarg is false)
/// int argument gives the axis as defined in QwtPlot::Axis
void axisScaleChanged(int,bool);

private slots:

void reresize(QSize,QSize);

private:
//! Finds bounding interval of the plot data.
QwtDoubleInterval axisBoundingInterval(int axis);
Expand Down

0 comments on commit e8d5e20

Please sign in to comment.