QTIPlot Windows Build2

From MantidProject

Jump to: navigation, search

Contents

Download and install GPL version of QT

Instructions for Qt 4.3.4

Download for Qt 4.5.x

See also http://doc.trolltech.com/4.5/install-win.html

QTIPLOT Download

QWT

  • QWT is included in the QTIPlot download above
  • Edit qwtconfig.pri and remove the # from the start of the line CONFIG += QwtExamples
  • In a Visual studio console window
    • cd\qtiplot\3rdParty\qwt
    • set QMAKESPEC=win32-msvc2005
    • admin\msvc-qmake.bat
    • cd src
    • nmake

zlib

QWT-Plot3D

Note this is without zlib and debug!

  • Download from http://qwtplot3d.sourceforge.net
  • Extract to c:\qwtplot3d
  • Edit the file qwtplot3d.pro
    • Replace the word debug on line 6 with release
    • add # at the start of the line win32:TEMPLATE = vclib
    • add # at the start of the line win32:CONFIG -= zlib
    • insert a new line after this with INCLUDEPATH += c:/zlib
    • At the end of the file replace the line win32:LIBS += zlib.lib with the full correct path e.g. win32:LIBS += c:/zlib/projects/visualc6/Win32_DLL_Release/zlib1.lib
  • In a Visual studio console window
    • cd\qwt-5.0.2
    • set QMAKESPEC=win32-msvc
    • qmake
    • nmake
    • now go to the example directory
    • edit common.pro and add # at the start of the line win32:TEMPLATE = vcapp
    • in each of the subdirectories off example (mesh2 does not compile)
      • qmake
      • nmake

muParser

  • Download from http://muparser.sourceforge.net/
  • extract to c:\muParser
  • In Visual studion open the build\msvc8\muparser_dynamic.sln file
  • Edit the code as follows

muParserDef.h add the following after #ifndef #define MUP_DEF_H

#ifdef _WIN32
#ifdef MUPARSERLIB_EXPORTS
  #pragma warning( disable: 4251 )
  #define DLLExport __declspec( dllexport )
#else
  #define DLLExport __declspec( dllimport )
#endif
#else
  #define DLLExport
#endif

Then For every class add DLLExport to the class definition (note some .h files have more than one class)

e.g. class ParserError
becomes
class DLLExport ParserError
  • Change the configuration to release Dll
  • Build (note example 3 will fail as the .c file is actually a .cpp file)

GSL

I can't really remember I already had a compiled version of GSL. However this has been added to the third party section of SVN.

SIP

  • Download from http://www.riverbankcomputing.co.uk/software/sip/download
  • Extract to C:\sip-4.7.4; all following steps are carried out in that directory
  • At command line type "python configure.py -p win32-msvc2005"
  • Then type "nmake"
  • Type 'nmake install'
  • Check if c:\PythonXX contains sip.exe.manifest. If not, copy it from C:\sip-4.7.4\sipgen.
  • A path to MSVCR80.DLL must be in PATH.

PyQt

QScintilla

MantidPlot uses the QScintilla library for the scripting environment. The source code is available at http://www.riverbankcomputing.co.uk/software/qscintilla/download However, for most Linux distributions there are pre-built packages available.

To install the library, first download and unzip the code and then change to the directory where the code was unpacked and type

cd Qt4
qmake qscintilla.pro
nmake
nmake install

Note: On Linux substitute make for nmake

We also need the Python bindings so after the library is installed do

cd ..\Python
python configure.py
nmake
nmake install

QTIPLOT Build

  • Edit the c:\qtiplot\qtiplot\qtiplot.pro file
    • correct all the INCLUDEPATH paths and the WIN32:LIBS paths
    • Edit the line win32:DEFINES += QT_DLL QT_THREAD_SUPPORT _WINDOWS GSL_DLL WIN32
    • cd to c:\qtiplot\qtiplot
    • set QMAKESPEC=win32-msvc2005
    • qmake
    • nmake

Source code edits

Graph3d.cpp Line 2686

sp->setZoom(d/sqrt(3));
to
sp->setZoom(d/sqrt(3.0));

Table.cpp

Add the following include
#include <ctime>

FitDialog.cpp Line 759 AND 793

it->setFlags(!Qt::ItemIsEditable);
to
it->setFlags(it->flags() & (~Qt::ItemIsEditable));

FitDialog.cpp Line 1072

double paramsInit[n];
to
QVarLengthArray<double> paramsInit(n);

FitDialog.cpp Line 1124

modifyGuesses (paramsInit);
to
modifyGuesses (paramsInit.data());

FitDialog.cpp Line 1130

d_current_fit->setInitialGuesses(paramsInit);
to
d_current_fit->setInitialGuesses(paramsInit.data());

FitDialog.cpp Line 1425

double X[d_points], Y[d_points];
to
QVarLengthArray<double> X(d_points), Y(d_points);

FitDialog.cpp Line 1432

modifyGuesses(parameters);
to
modifyGuesses(parameters.data());

FitDialog.cpp Line 1439

Y[i] = d_current_fit->eval(parameters, x);
to
Y[i] = d_current_fit->eval(parameters.data(), x);

FitDialog.cpp Line 1449

d_preview_curve->setData(X, Y, d_points);
to
d_preview_curve->setData(X.data(), Y.data(), d_points);

ApplicationWindow.cpp Line 8765

hfi.dir().absolutePath(), !QFileDialog::ShowDirsOnly);
to
hfi.dir().absolutePath(), 0);

QwtHistogram.cpp Line 181

double X[n];
to 
QVarLengthArray<double> X(n);
and (8 lines down)
setData(X, Y.data(), n);
to 
setData(X.data(), Y.data(), n);

QwtHistogram.cpp Line 244

double X[n], Y[n];
to 
QVarLengthArray<double> X(n), Y(n);
and (line 251)
setData(X, Y, n);
to 
setData(X.data(), Y.data(), n);

QwtHistogram.cpp Line 275

double x[n], y[n];
to 
QVarLengthArray<double> x(n), y(n);
and (line 304)
setData(x, y, n);
to 
setData(x.data(), y.data(), n);

FunctionCurve.cpp Line 102

double X[points], Y[points];
to
QVarLengthArray<double> X(points),Y(points);
and Line 152
setData(X, Y, points);
to 
setData(X.data(), Y.data(), points);

MultiPeakFit.cpp line 182

double temp[d_n];
to
QVarLengthArray<double> temp(d_n);
and line 185
size_t imax_temp = gsl_stats_max_index(temp, 1, d_n);
to 
size_t imax_temp = gsl_stats_max_index(temp.data(), 1, d_n);

MultiPeakFit.cpp line 588

double temp[d_n];
to
QVarLengthArray<double> temp(d_n);
and line 591
size_t imax_temp = gsl_stats_max_index(temp, 1, d_n);
to 
size_t imax_temp = gsl_stats_max_index(temp.data(), 1, d_n);

MultiPeakFit.cpp line 255

double X[d_points], Y[d_points];
to
QVarLengthArray<double> X(d_points), Y(d_points);
line 282
insertFitFunctionCurve(QString(objectName()) + tr("Fit"), X, Y, 2);
to
insertFitFunctionCurve(QString(objectName()) + tr("Fit"), X.data(), Y.data(), 2);
line 284
insertFitFunctionCurve(QString(objectName()) + tr("Fit"), X, Y);
to
insertFitFunctionCurve(QString(objectName()) + tr("Fit"), X.data(), Y.data()); 
line 291
insertPeakFunctionCurve(X, Y, i);
to
insertPeakFunctionCurve(X.data(), Y.data(), i);

MultiPeakFit.cpp line 349

c->setData(X, Y, d_points);
to 
c->setData(X.data(), Y.data(), d_points);
line 361
c->setData(X, Y, d_points);
to
c->setData(X.data(), Y.data(), d_points);

ColorMapEditor.cpp Line 126 and 158

it->setFlags(!Qt::ItemIsEditable);
to
it->setFlags(it->flags() & (~Qt::ItemIsEditable));

Convolution.cpp Line 141

double x_temp[d_n];
to
QVarLengthArray<double> x_temp(d_n);
and line 165
c->setData(x_temp, d_x, d_n);
to 
c->setData(x_temp.data(), d_x, d_n);

Correlation.cpp line 154

double x_temp[d_n], y_temp[d_n];
to
QVarLengthArray<double> x_temp(d_n), y_temp(d_n);
and line 184
c->setData(x_temp, y_temp, d_n);
to
c->setData(x_temp.data(), y_temp.data(), d_n);

MultiPeakFitTool.cpp Line 114

double temp[n];
to
QVarLengthArray<double> temp(n);
and line 117
size_t imax_temp = gsl_stats_max_index(temp, 1, n);
to 
size_t imax_temp = gsl_stats_max_index(temp.data(), 1, n);

ConfigDialog.cpp lines 1544 and 1575

tfi.dir().absolutePath(), !QFileDialog::ShowDirsOnly);
to
tfi.dir().absolutePath(), 0);

Filter.cpp lines 219 - 221

double X[d_points], Y[d_points];
calculateOutputData(X, Y); //does the data analysis
addResultCurve(X, Y);
to
QVarLengthArray<double> X(d_points), Y(d_points);
calculateOutputData(X.data(), Y.data()); //does the data analysis
addResultCurve(X.data(), Y.data());

analysis/fft2D.cpp

insert #define _USE_MATH_DEFINES before #include <math.h> (line 32)
insert #include <QVarLengthArray>

analysis/fft2D.cpp line 38

const double SQ_2=sqrt(2);
to
const double SQ_2=sqrt(2.0);

analysis/fft2D.cpp line 39

double pair_re[size_2], pair_im[size_2], impair_re[size_2], impair_im[size_2];
to
QVarLengthArray<double> pair_re(size_2), pair_im(size_2), impair_re(size_2), impair_im(size_2);
lines 49 and 50
fft(pair_re,pair_im,size_2);
fft(impair_re,impair_im,size_2);
to
fft(pair_re.data(),pair_im.data(),size_2);
fft(impair_re.data(),impair_im.data(),size_2);

analysis/fft2D.cpp line 68

const double SQ_2=sqrt(2);
to
const double SQ_2=sqrt(2.0);

analysis/fft2D.cpp line 69

double pair_re[size_2], pair_im[size_2], impair_re[size_2], impair_im[size_2];
to
QVarLengthArray<double> pair_re(size_2), pair_im(size_2), impair_re(size_2), impair_im(size_2);

analysis/fft2D.cpp lines 79 and 80

fft_inv(pair_re, pair_im,size_2);
fft_inv(impair_re, impair_im,size_2);
to
fft_inv(pair_re.data(), pair_im.data(),size_2);
fft_inv(impair_re.data(), impair_im.data(),size_2);

analysis/fft2D.cpp line 105

double x_int_l[width], x_int2_l[width], x_int_c[height], x_int2_c[height];
to
QVarLengthArray<double> x_int_l(width), x_int2_l(width), x_int_c(height), x_int2_c(height);

analysis/fft2D.cpp line 114

fft(x_int_l, x_int2_l, width);
to
fft(x_int_l.data(), x_int2_l.data(), width);

analysis/fft2D.cpp line 126

fft(x_int_c,x_int2_c, height) ;
to
fft(x_int_c.data(),x_int2_c.data(), height) ;

analysis/fft2D.cpp line 147

double x_int_l[width], x_int2_l[width], x_int_c[height], x_int2_c[height];
to
QVarLengthArray<double> x_int_l(width), x_int2_l(width), x_int_c(height), x_int2_c(height);

analysis/fft2D.cpp line 153

fft_inv(x_int_l, x_int2_l, width) ;
to
fft_inv(x_int_l.data(), x_int2_l.data(), width) ;

analysis/fft2D.cpp line 164

fft_inv(x_int_c,x_int2_c, height) ;
to
fft_inv(x_int_c.data(),x_int2_c.data(), height) ;

qtiplot.pro line 109

win32:DEFINES += QT_DLL QT_THREAD_SUPPORT
to
win32:DEFINES += QT_DLL QT_THREAD_SUPPORT _WINDOWS
Personal tools
Create a book