~uhh-ssd/+junk/humidity_readout

« back to all changes in this revision

Viewing changes to plplot/plplot-5.9.9/examples/c++/qt_example.cpp

  • Committer: Joachim Erfle
  • Date: 2013-07-24 13:53:41 UTC
  • Revision ID: joachim.erfle@desy.de-20130724135341-1qojpp701zsn009p
initial commit

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
//
 
2
//
 
3
// This software is provided under the LGPL in March 2009 by the
 
4
// Cluster Science Centre
 
5
// QSAS team,
 
6
// Imperial College, London
 
7
//
 
8
// Copyright (C) 2009  Imperial College, London
 
9
//
 
10
// This is free software; you can redistribute it and/or modify
 
11
// it under the terms of the GNU General Lesser Public License as published
 
12
// by the Free Software Foundation; either version 2 of the License, or
 
13
// (at your option) any later version.
 
14
//
 
15
// This software is distributed in the hope that it will be useful,
 
16
// but WITHOUT ANY WARRANTY; without even the implied warranty of
 
17
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
18
// GNU Lesser General Public License for more details.
 
19
//
 
20
// To received a copy of the GNU Library General Public License
 
21
// write to the Free Software Foundation, Inc.,
 
22
// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
 
23
//
 
24
//
 
25
 
 
26
#include "qt_PlotWindow.h"
 
27
 
 
28
int main( int argc, char** argv )
 
29
{
 
30
    int res;
 
31
 
 
32
    // Command-line options are only to be interpreted by PLplot.  Thus,
 
33
    // make a deep copy of the arguments for PLplot use before QApplication
 
34
    // has a chance to alter them.
 
35
    int Argc = argc;
 
36
    char** Argv;
 
37
 
 
38
    Argv = new char*[argc];
 
39
    for ( int i = 0; i < Argc; ++i )
 
40
    {
 
41
        int len = strlen( argv[i] ) + 1;
 
42
        Argv[i] = new char[len];
 
43
        strncpy( Argv[i], argv[i], len );
 
44
    }
 
45
 
 
46
    // Limit QApplication's interpretation of argv to just the first
 
47
    // argument (the application name) so that all command-line
 
48
    // options such as the PLplot -bg command-line option (which would
 
49
    // generate a warning message when misinterpreted by QApplication)
 
50
    // are completely ignored.
 
51
    argc = 1;
 
52
    QApplication a( argc, argv );
 
53
    PlotWindow   * win = new PlotWindow( Argc, Argv );
 
54
    a.setActiveWindow( win );
 
55
    win->setVisible( true );
 
56
 
 
57
    res = a.exec();
 
58
 
 
59
    for ( int i = 0; i < Argc; ++i )
 
60
    {
 
61
        delete[] Argv[i];
 
62
    }
 
63
    delete[] Argv;
 
64
 
 
65
    return res;
 
66
}