Index: src/sas/qtgui/GuiUtils.py
===================================================================
--- src/sas/qtgui/GuiUtils.py	(revision aadf0af183702570addb989ed535f1c04f06b3df)
+++ src/sas/qtgui/GuiUtils.py	(revision 570a58f9169c78f01c6e69cc89a1960671e5a13d)
@@ -693,2 +693,20 @@
     """
     return item.child(0).data().toPyObject()
+
+def formatNumber(value, high=False):
+    """
+    Return a float in a standardized, human-readable formatted string.
+    This is used to output readable (e.g. x.xxxe-y) values to the panel.
+    """
+    try:
+        value = float(value)
+    except:
+        output = "NaN"
+        return output.lstrip().rstrip()
+
+    if high:
+        output = "%-6.4g" % value
+
+    else:
+        output = "%-5.3g" % value
+    return output.lstrip().rstrip()
Index: src/sas/qtgui/LinearFit.py
===================================================================
--- src/sas/qtgui/LinearFit.py	(revision 570a58f9169c78f01c6e69cc89a1960671e5a13d)
+++ src/sas/qtgui/LinearFit.py	(revision 570a58f9169c78f01c6e69cc89a1960671e5a13d)
@@ -0,0 +1,283 @@
+"""
+Adds a linear fit plot to the chart
+"""
+import numpy
+from PyQt4 import QtGui
+from PyQt4 import QtCore
+
+#from sas.sasgui.transform import 
+from sas.qtgui.GuiUtils import formatNumber
+from sas.sasgui.plottools import fittings
+from sas.sasgui.plottools import transform
+
+from sas.sasgui.plottools.LineModel import LineModel
+
+# Local UI
+from sas.qtgui.UI.LinearFitUI import Ui_LinearFitUI
+
+class LinearFit(QtGui.QDialog, Ui_LinearFitUI):
+    def __init__(self, parent=None,
+                 data=None,
+                 max_range=(0.0, 0.0),
+                 fit_range=(0.0, 0.0),
+                 xlabel="",
+                 ylabel=""):
+        super(LinearFit, self).__init__()
+
+        self.setupUi(self)
+        assert(isinstance(max_range, tuple))
+        assert(isinstance(fit_range, tuple))
+
+        self.data = data
+        self.parent = parent
+
+        self.max_range = max_range
+        self.fit_range = fit_range
+        self.xLabel = xlabel
+        self.yLabel = ylabel
+
+        self.txtFitRangeMin.setValidator(QtGui.QDoubleValidator())
+        self.txtFitRangeMax.setValidator(QtGui.QDoubleValidator())
+
+        # Default values in the line edits
+        self.txtA.setText("1")
+        self.txtB.setText("1")
+        self.txtAerr.setText("0")
+        self.txtBerr.setText("0")
+        self.txtChi2.setText("0")
+        # Initial ranges
+        self.txtRangeMin.setText(str(max_range[0]))
+        self.txtRangeMax.setText(str(max_range[1]))
+        self.txtFitRangeMin.setText(str(fit_range[0]))
+        self.txtFitRangeMax.setText(str(fit_range[1]))
+
+        self.lblRange.setText('Fit range of ' + self.xLabel)
+
+        self.model = LineModel()
+        # Display the fittings values
+        self.default_A = self.model.getParam('A')
+        self.default_B = self.model.getParam('B')
+        self.cstA = fittings.Parameter(self.model, 'A', self.default_A)
+        self.cstB = fittings.Parameter(self.model, 'B', self.default_B)
+        self.transform = transform
+
+        self.cmdFit.clicked.connect(self.fit)
+
+    def setRangeLabel(self, label=""):
+        """
+        Overwrite default fit range label to correspond to actual unit
+        """
+        assert(isinstance(label, basestring))
+        self.lblRange.setText(label)
+
+    def a(self):
+        return (float(self.txtA.text()), float(self.txtAerr.text()))
+
+    def b(self):
+        return (float(self.txtB.text()), float(self.txtBerr.text()))
+
+    def chi(self):
+        return float(self.txtChi2.text())
+
+    def range(self):
+        return (float(self.txtFitRangeMin.text()), float(self.txtFitRangeMax.text()))
+
+    def fit(self, event):
+        """
+        Performs the fit. Receive an event when clicking on
+        the button Fit.Computes chisqr ,
+        A and B parameters of the best linear fit y=Ax +B
+        Push a plottable to the caller
+        """
+        tempx = []
+        tempy = []
+        tempdy = []
+
+        # Checks to assure data correctness
+        if len(self.data.view.x) < 2:
+            return
+        if not self.checkFitValues(self.txtFitRangeMin):
+            return
+
+        self.xminFit, self.xmaxFit = self.range()
+
+        xminView = self.xminFit
+        xmaxView = self.xmaxFit
+        xmin = xminView
+        xmax = xmaxView
+        # Set the qmin and qmax in the panel that matches the
+        # transformed min and max
+        self.txtRangeMin.setText(formatNumber(self.floatInvTransform(xmin)))
+        self.txtRangeMax.setText(formatNumber(self.floatInvTransform(xmax)))
+
+        # Store the transformed values of view x, y and dy before the fit
+        xmin_check = numpy.log10(xmin)
+        x = self.data.view.x
+        y = self.data.view.y
+        dy = self.data.view.dy
+
+        if self.yLabel == "log10(y)":
+            if self.xLabel == "log10(x)":
+                tempy  = [numpy.log10(y[i])
+                         for i in range(len(x)) if x[i] >= xmin_check]
+                tempdy = [transform.errToLogX(y[i], 0, dy[i], 0)
+                         for i in range(len(x)) if x[i] >= xmin_check]
+            else:
+                tempy = map(numpy.log10, y)
+                tempdy = map(lambda t1,t2:transform.errToLogX(t1,0,t2,0),y,dy)
+        else:
+            tempy = y
+            tempdy = dy
+
+        if self.xLabel == "log10(x)":
+            tempx = [numpy.log10(x) for x in self.data.view.x if x > xmin_check]
+        else:
+            tempx = self.data.view.x
+
+        # Find the fitting parameters
+        # Always use the same defaults, so that fit history
+        # doesn't play a role!
+        self.cstA = fittings.Parameter(self.model, 'A', self.default_A)
+        self.cstB = fittings.Parameter(self.model, 'B', self.default_B)
+        tempdy = numpy.asarray(tempdy)
+        tempdy[tempdy == 0] = 1
+
+        if self.xLabel == "log10(x)":
+            chisqr, out, cov = fittings.sasfit(self.model,
+                                               [self.cstA, self.cstB],
+                                               tempx, tempy,
+                                               tempdy,
+                                               numpy.log10(xmin),
+                                               numpy.log10(xmax))
+        else:
+            chisqr, out, cov = fittings.sasfit(self.model,
+                                               [self.cstA, self.cstB],
+                                               tempx, tempy, tempdy,
+                                               xminView, xmaxView)
+        # Use chi2/dof
+        if len(tempx) > 0:
+            chisqr = chisqr / len(tempx)
+
+        # Check that cov and out are iterable before displaying them
+        errA = numpy.sqrt(cov[0][0]) if cov is not None else 0
+        errB = numpy.sqrt(cov[1][1]) if cov is not None else 0
+        cstA = out[0] if out is not None else 0.0
+        cstB = out[1] if out is not None else 0.0
+
+        # Reset model with the right values of A and B
+        self.model.setParam('A', float(cstA))
+        self.model.setParam('B', float(cstB))
+
+        tempx = []
+        tempy = []
+        y_model = 0.0
+        # load tempy with the minimum transformation
+        if self.xLabel == "log10(x)":
+            y_model = self.model.run(numpy.log10(xmin))
+            tempx.append(xmin)
+        else:
+            y_model = self.model.run(xminView)
+            tempx.append(xminView)
+
+        if self.yLabel == "log10(y)":
+            tempy.append(numpy.power(10, y_model))
+        else:
+            tempy.append(y_model)
+
+        # load tempy with the maximum transformation
+        if self.xLabel == "log10(x)":
+            y_model = self.model.run(numpy.log10(xmax))
+            tempx.append(xmax)
+        else:
+            y_model = self.model.run(xmaxView)
+            tempx.append(xmaxView)
+
+        if self.yLabel == "log10(y)":
+            tempy.append(numpy.power(10, y_model))
+        else:
+            tempy.append(y_model)
+        # Set the fit parameter display when  FitDialog is opened again
+        self.Avalue = cstA
+        self.Bvalue = cstB
+        self.ErrAvalue = errA
+        self.ErrBvalue = errB
+        self.Chivalue = chisqr
+
+        # Update the widget
+        self.txtA.setText(formatNumber(self.Avalue))
+        self.txtAerr.setText(formatNumber(self.ErrAvalue))
+        self.txtB.setText(formatNumber(self.Bvalue))
+        self.txtBerr.setText(formatNumber(self.ErrBvalue))
+        self.txtChi2.setText(formatNumber(self.Chivalue))
+
+        #self.parent.updatePlot.emit((tempx, tempy))
+        self.parent.emit(QtCore.SIGNAL('updatePlot'), (tempx, tempy))
+
+    def checkFitValues(self, item):
+        """
+        Check the validity of input values
+        """
+        flag = True
+        value = item.text()
+        p_white = item.palette()
+        p_white.setColor(item.backgroundRole(), QtCore.Qt.white)
+        p_pink = item.palette()
+        p_pink.setColor(item.backgroundRole(), QtGui.QColor(255, 128, 128))
+        # Check for possible values entered
+        if self.xLabel == "log10(x)":
+            if float(value) > 0:
+                item.setPalette(p_white)
+            else:
+                flag = False
+                item.setPalette(p_pink)
+        return flag
+
+    #def checkFitRanges(self, usermin, usermax):
+    #    """
+    #    Ensure that fields parameter contains a min and a max value
+    #    within x min and x max range
+    #    """
+    #    self.mini = float(self.xminFit.GetValue())
+    #    self.maxi = float(self.xmaxFit.GetValue())
+    #    flag = True
+    #    try:
+    #        mini = float(usermin.GetValue())
+    #        maxi = float(usermax.GetValue())
+    #        if mini < maxi:
+    #            usermin.SetBackgroundColour(wx.WHITE)
+    #            usermin.Refresh()
+    #        else:
+    #            flag = False
+    #            usermin.SetBackgroundColour("pink")
+    #            usermin.Refresh()
+    #    except:
+    #        # Check for possible values entered
+    #        flag = False
+    #        usermin.SetBackgroundColour("pink")
+    #        usermin.Refresh()
+
+    #    return flag
+    def floatInvTransform(self, x):
+        """
+        transform a float.It is used to determine the x.View min and x.View
+        max for values not in x.  Also used to properly calculate RgQmin,
+        RgQmax and to update qmin and qmax in the linear range boxes on the
+        panel.
+
+        """
+        # TODO: refactor this. This is just a hack to make the
+        # functionality work without rewritting the whole code
+        # with good design (which really should be done...).
+        if self.xLabel == "x":
+            return x
+        elif self.xLabel == "x^(2)":
+            return numpy.sqrt(x)
+        elif self.xLabel == "x^(4)":
+            return numpy.sqrt(math.sqrt(x))
+        elif self.xLabel == "log10(x)":
+            return numpy.power(10, x)
+        elif self.xLabel == "ln(x)":
+            return numpy.exp(x)
+        elif self.xLabel == "log10(x^(4))":
+            return numpy.sqrt(numpy.sqrt(numpy.power(10, x)))
+        return x
Index: src/sas/qtgui/Plotter.py
===================================================================
--- src/sas/qtgui/Plotter.py	(revision aadf0af183702570addb989ed535f1c04f06b3df)
+++ src/sas/qtgui/Plotter.py	(revision 570a58f9169c78f01c6e69cc89a1960671e5a13d)
@@ -12,4 +12,5 @@
 from sas.qtgui.AddText import AddText
 from sas.qtgui.SetGraphRange import SetGraphRange
+from sas.qtgui.LinearFit import LinearFit
 
 class PlotterWidget(PlotterBase):
@@ -19,4 +20,5 @@
     def __init__(self, parent=None, manager=None, quickplot=False):
         super(PlotterWidget, self).__init__(parent, manager=manager, quickplot=quickplot)
+
         self.parent = parent
         self.addText = AddText(self)
@@ -27,4 +29,19 @@
         # Simple window for data display
         self.txt_widget = QtGui.QTextEdit(None)
+
+        self.xLogLabel = "log10(x)"
+        self.yLogLabel = "log10(y)"
+
+        # Data container for the linear fit
+        self.fit_result = Data1D(x=[], y=[], dy=None)
+        self.fit_result.symbol = 13
+        self.fit_result.name = "Fit"
+
+        # Add a slot for receiving update signal from LinearFit
+        # NEW style signals - don't work!
+        #self.updatePlot = QtCore.pyqtSignal(tuple)
+        #self.updatePlot.connect(self.updateWithData)
+        # OLD style signals - work perfectly
+        QtCore.QObject.connect(self, QtCore.SIGNAL('updatePlot'), self.onFitDisplay)
 
     @property
@@ -48,4 +65,6 @@
             self.data = data
         assert(self._data)
+
+        is_fit = (self._data.id=="fit")
 
         # Shortcut for an axis
@@ -87,9 +106,11 @@
 
         # Current labels for axes
-        ax.set_ylabel(self.y_label)
-        ax.set_xlabel(self.x_label)
+        if self.y_label and not is_fit:
+            ax.set_ylabel(self.y_label)
+        if self.x_label and not is_fit:
+            ax.set_xlabel(self.x_label)
 
         # Title only for regular charts
-        if not self.quickplot:
+        if not self.quickplot and not is_fit:
             ax.set_title(label=self._title)
 
@@ -161,5 +182,6 @@
             if plot.id != 'fit':
                 self.actionLinearFit = plot_menu.addAction('&Linear Fit')
-                self.actionLinearFit.triggered.connect(self.onLinearFit)
+                self.actionLinearFit.triggered.connect(
+                                functools.partial(self.onLinearFit, id))
                 plot_menu.addSeparator()
 
@@ -209,6 +231,6 @@
         """
         if self.properties.exec_() == QtGui.QDialog.Accepted:
-            xLabel, yLabel = self.properties.getValues()
-            self.xyTransform(xLabel, yLabel)
+            self.xLogLabel, self.yLogLabel = self.properties.getValues()
+            self.xyTransform(self.xLogLabel, self.yLogLabel)
 
     def onModifyGraph(self):
@@ -319,14 +341,39 @@
         GuiUtils.saveData1D(plot_data)
 
-    def onLinearFit(self):
+    def onLinearFit(self, id):
         """
         Creates and displays a simple linear fit for the selected plot
         """
-        pass
+        selected_plot = self.plot_dict[id]
+
+        maxrange = (min(selected_plot.x), max(selected_plot.x))
+        fitrange = self.ax.get_xlim()
+
+        fit_dialog = LinearFit(parent=self,
+                    data=selected_plot,
+                    max_range=maxrange,
+                    fit_range=fitrange,
+                    xlabel=self.xLogLabel,
+                    ylabel=self.yLogLabel)
+        if fit_dialog.exec_() == QtGui.QDialog.Accepted:
+            return
 
     def onRemovePlot(self, id):
         """
+        Responds to the plot delete action
+        """
+        self.removePlot(id)
+
+        if len(self.plot_dict) == 0:
+            # last plot: graph is empty must be the panel must be destroyed
+                self.parent.close()
+
+    def removePlot(self, id):
+        """
         Deletes the selected plot from the chart
         """
+        if id not in self.plot_dict:
+            return
+
         selected_plot = self.plot_dict[id]
 
@@ -341,8 +388,4 @@
             if ids != id:
                 self.plot(data=plot_dict[ids], hide_error=plot_dict[ids].hide_error)                
-
-        if len(self.plot_dict) == 0:
-            # last plot: graph is empty must be the panel must be destroyed
-                self.parent.close()
 
     def onFreeze(self, id):
@@ -387,16 +430,49 @@
         Transforms x and y in View and set the scale
         """
-        # Clear the plot first
-        plt.cla()
-        self.ax.cla()
-
-        new_xlabel, new_ylabel, xscale, yscale = GuiUtils.xyTransform(self.data, xLabel, yLabel)
-        self.xscale = xscale
-        self.yscale = yscale
-        self.xLabel = new_xlabel
-        self.yLabel = new_ylabel
-
-        # Plot the updated chart
-        self.plot(marker='o', linestyle='')
+        # Transform all the plots on the chart
+        for id in self.plot_dict.keys():
+            current_plot = self.plot_dict[id]
+            if current_plot.id == "fit":
+                self.removePlot(id)
+                continue
+            new_xlabel, new_ylabel, xscale, yscale =\
+                GuiUtils.xyTransform(current_plot, xLabel, yLabel)
+            self.xscale = xscale
+            self.yscale = yscale
+            self.xLabel = new_xlabel
+            self.yLabel = new_ylabel
+            # Plot the updated chart
+            self.removePlot(id)
+            self.plot(data=current_plot, marker='o', linestyle='')
+
+        pass # debug hook
+
+    def onFitDisplay(self, fit_data):
+        """
+        Add a linear fitting line to the chart
+        """
+        # Create new data structure with fitting result
+        tempx = fit_data[0]
+        tempy = fit_data[1]
+        self.fit_result.x = []
+        self.fit_result.y = []
+        self.fit_result.x = tempx
+        self.fit_result.y = tempy
+        self.fit_result.dx = None
+        self.fit_result.dy = None
+
+        #Remove another Fit, if exists
+        self.removePlot("fit")
+
+        self.fit_result.reset_view()
+        #self.offset_graph()
+
+        # Set plot properties
+        self.fit_result.id = 'fit'
+        self.fit_result.title = 'Fit'
+        self.fit_result.name = 'Fit'
+
+        # Plot the line
+        self.plot(data=self.fit_result, marker='', linestyle='solid', hide_error=True)
 
 
Index: src/sas/qtgui/PlotterBase.py
===================================================================
--- src/sas/qtgui/PlotterBase.py	(revision aadf0af183702570addb989ed535f1c04f06b3df)
+++ src/sas/qtgui/PlotterBase.py	(revision 570a58f9169c78f01c6e69cc89a1960671e5a13d)
@@ -58,4 +58,8 @@
 
         # Mouse click related
+        self._scale_xlo = None
+        self._scale_xhi = None
+        self._scale_ylo = None
+        self._scale_yhi = None
         self.x_click = None
         self.y_click = None
@@ -70,6 +74,6 @@
         # Pre-define the Scale properties dialog
         self.properties = ScaleProperties(self,
-                                          init_scale_x=self.x_label,
-                                          init_scale_y=self.y_label)
+                                init_scale_x=self.x_label,
+                                init_scale_y=self.y_label)
 
         # default color map
@@ -460,2 +464,12 @@
         # Notify the listeners about a new graph title
         self.manager.communicator.activeGraphName.emit((current_title, title))
+
+    def offset_graph(self):
+        """
+        Zoom and offset the graph to the last known settings
+        """
+        for ax in self.axes:
+            if self._scale_xhi is not None and self._scale_xlo is not None:
+                ax.set_xlim(self._scale_xlo, self._scale_xhi)
+            if self._scale_yhi is not None and self._scale_ylo is not None:
+                ax.set_ylim(self._scale_ylo, self._scale_yhi)
Index: src/sas/qtgui/UI/LinearFitUI.ui
===================================================================
--- src/sas/qtgui/UI/LinearFitUI.ui	(revision 570a58f9169c78f01c6e69cc89a1960671e5a13d)
+++ src/sas/qtgui/UI/LinearFitUI.ui	(revision 570a58f9169c78f01c6e69cc89a1960671e5a13d)
@@ -0,0 +1,289 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>LinearFitUI</class>
+ <widget class="QDialog" name="LinearFitUI">
+  <property name="geometry">
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>413</width>
+    <height>327</height>
+   </rect>
+  </property>
+  <property name="sizePolicy">
+   <sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding">
+    <horstretch>0</horstretch>
+    <verstretch>0</verstretch>
+   </sizepolicy>
+  </property>
+  <property name="windowTitle">
+   <string>Linear Fit</string>
+  </property>
+  <property name="windowIcon">
+   <iconset resource="main_resources.qrc">
+    <normaloff>:/res/ball.ico</normaloff>:/res/ball.ico</iconset>
+  </property>
+  <layout class="QGridLayout" name="gridLayout_4">
+   <item row="0" column="0">
+    <widget class="QLabel" name="label">
+     <property name="text">
+      <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Perform fit for &lt;span style=&quot; font-style:italic;&quot;&gt;y(x) = ax + b&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
+     </property>
+    </widget>
+   </item>
+   <item row="1" column="0" colspan="2">
+    <widget class="QGroupBox" name="groupBox">
+     <property name="title">
+      <string>Fit parameters</string>
+     </property>
+     <layout class="QGridLayout" name="gridLayout">
+      <item row="0" column="0">
+       <layout class="QFormLayout" name="formLayout">
+        <item row="0" column="0">
+         <widget class="QLabel" name="label_3">
+          <property name="text">
+           <string>a</string>
+          </property>
+         </widget>
+        </item>
+        <item row="0" column="1">
+         <widget class="QLineEdit" name="txtA">
+          <property name="toolTip">
+           <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Fit value for the slope parameter.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
+          </property>
+          <property name="readOnly">
+           <bool>true</bool>
+          </property>
+         </widget>
+        </item>
+        <item row="1" column="0">
+         <widget class="QLabel" name="label_4">
+          <property name="text">
+           <string>b</string>
+          </property>
+         </widget>
+        </item>
+        <item row="1" column="1">
+         <widget class="QLineEdit" name="txtB">
+          <property name="toolTip">
+           <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Fit value for the constant parameter.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
+          </property>
+          <property name="readOnly">
+           <bool>true</bool>
+          </property>
+         </widget>
+        </item>
+        <item row="2" column="0">
+         <widget class="QLabel" name="label_7">
+          <property name="text">
+           <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Ï&lt;span style=&quot; vertical-align:super;&quot;&gt;2&lt;/span&gt;/dof&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
+          </property>
+         </widget>
+        </item>
+        <item row="2" column="1">
+         <widget class="QLineEdit" name="txtChi2">
+          <property name="toolTip">
+           <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Ï&lt;span style=&quot; vertical-align:super;&quot;&gt;2&lt;/span&gt; over degrees of freedom.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
+          </property>
+          <property name="readOnly">
+           <bool>true</bool>
+          </property>
+         </widget>
+        </item>
+       </layout>
+      </item>
+      <item row="0" column="1">
+       <layout class="QFormLayout" name="formLayout_2">
+        <item row="0" column="0">
+         <widget class="QLabel" name="label_5">
+          <property name="text">
+           <string>+/-</string>
+          </property>
+         </widget>
+        </item>
+        <item row="0" column="1">
+         <widget class="QLineEdit" name="txtAerr">
+          <property name="toolTip">
+           <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Error on the slope parameter.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
+          </property>
+          <property name="readOnly">
+           <bool>true</bool>
+          </property>
+         </widget>
+        </item>
+        <item row="1" column="0">
+         <widget class="QLabel" name="label_6">
+          <property name="text">
+           <string>+/-</string>
+          </property>
+         </widget>
+        </item>
+        <item row="1" column="1">
+         <widget class="QLineEdit" name="txtBerr">
+          <property name="toolTip">
+           <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Error on the constant parameter.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
+          </property>
+          <property name="readOnly">
+           <bool>true</bool>
+          </property>
+         </widget>
+        </item>
+       </layout>
+      </item>
+     </layout>
+    </widget>
+   </item>
+   <item row="2" column="0" colspan="2">
+    <widget class="QGroupBox" name="groupBox_2">
+     <property name="title">
+      <string>Fit ranges</string>
+     </property>
+     <layout class="QGridLayout" name="gridLayout_3">
+      <item row="0" column="0">
+       <layout class="QGridLayout" name="gridLayout_2">
+        <item row="0" column="1">
+         <widget class="QLabel" name="label_9">
+          <property name="text">
+           <string>Min</string>
+          </property>
+         </widget>
+        </item>
+        <item row="0" column="2">
+         <widget class="QLabel" name="label_10">
+          <property name="text">
+           <string>Max</string>
+          </property>
+         </widget>
+        </item>
+        <item row="1" column="0">
+         <widget class="QLabel" name="label_8">
+          <property name="text">
+           <string>Range (linear scale)</string>
+          </property>
+         </widget>
+        </item>
+        <item row="1" column="1">
+         <widget class="QLineEdit" name="txtRangeMin">
+          <property name="toolTip">
+           <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Minimum value on the x-axis for the plotted data.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
+          </property>
+          <property name="readOnly">
+           <bool>true</bool>
+          </property>
+         </widget>
+        </item>
+        <item row="1" column="2">
+         <widget class="QLineEdit" name="txtRangeMax">
+          <property name="toolTip">
+           <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Maximum value on the x-axis for the plotted data.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
+          </property>
+          <property name="readOnly">
+           <bool>true</bool>
+          </property>
+         </widget>
+        </item>
+        <item row="2" column="0">
+         <widget class="QLabel" name="lblRange">
+          <property name="text">
+           <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Fit range&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
+          </property>
+         </widget>
+        </item>
+        <item row="2" column="1">
+         <widget class="QLineEdit" name="txtFitRangeMin">
+          <property name="toolTip">
+           <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Enter the minimum value on the x-axis to be included in the fit.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
+          </property>
+         </widget>
+        </item>
+        <item row="2" column="2">
+         <widget class="QLineEdit" name="txtFitRangeMax">
+          <property name="toolTip">
+           <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Enter the maximum value on the x-axis to be included in the fit.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
+          </property>
+         </widget>
+        </item>
+       </layout>
+      </item>
+     </layout>
+    </widget>
+   </item>
+   <item row="3" column="0" colspan="2">
+    <widget class="QLabel" name="label_2">
+     <property name="text">
+      <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;&lt;span style=&quot; color:#ff0000;&quot;&gt;WARNING! Resolution is NOT accounted for.&lt;br/&gt;Thus slit smeared data will give very wrong answers!&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
+     </property>
+    </widget>
+   </item>
+   <item row="4" column="1">
+    <spacer name="verticalSpacer">
+     <property name="orientation">
+      <enum>Qt::Vertical</enum>
+     </property>
+     <property name="sizeHint" stdset="0">
+      <size>
+       <width>20</width>
+       <height>3</height>
+      </size>
+     </property>
+    </spacer>
+   </item>
+   <item row="5" column="0" colspan="2">
+    <layout class="QHBoxLayout" name="horizontalLayout_2">
+     <item>
+      <spacer name="horizontalSpacer">
+       <property name="orientation">
+        <enum>Qt::Horizontal</enum>
+       </property>
+       <property name="sizeHint" stdset="0">
+        <size>
+         <width>40</width>
+         <height>20</height>
+        </size>
+       </property>
+      </spacer>
+     </item>
+     <item>
+      <layout class="QHBoxLayout" name="horizontalLayout">
+       <item>
+        <widget class="QPushButton" name="cmdFit">
+         <property name="text">
+          <string>Fit</string>
+         </property>
+        </widget>
+       </item>
+       <item>
+        <widget class="QPushButton" name="cmdClose">
+         <property name="text">
+          <string>Close</string>
+         </property>
+        </widget>
+       </item>
+      </layout>
+     </item>
+    </layout>
+   </item>
+  </layout>
+ </widget>
+ <resources>
+  <include location="main_resources.qrc"/>
+ </resources>
+ <connections>
+  <connection>
+   <sender>cmdClose</sender>
+   <signal>clicked()</signal>
+   <receiver>LinearFitUI</receiver>
+   <slot>accept()</slot>
+   <hints>
+    <hint type="sourcelabel">
+     <x>284</x>
+     <y>304</y>
+    </hint>
+    <hint type="destinationlabel">
+     <x>166</x>
+     <y>163</y>
+    </hint>
+   </hints>
+  </connection>
+ </connections>
+</ui>
