File: main.cpp

package info (click to toggle)
qwt 6.1.4-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye, forky, sid, trixie
  • size: 23,808 kB
  • sloc: cpp: 57,687; xml: 182; makefile: 32
file content (49 lines) | stat: -rw-r--r-- 1,022 bytes parent folder | download | duplicates (9)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#include <qapplication.h>
#include <qmainwindow.h>
#include <qtoolbar.h>
#include <qtoolbutton.h>
#include "plot.h"

class MainWindow: public QMainWindow
{
public:
    MainWindow( const QString &fileName )
    {
        Plot *plot = new Plot( this );
        if ( !fileName.isEmpty() )
            plot->loadSVG( fileName );

        setCentralWidget( plot );

#ifndef QT_NO_FILEDIALOG

        QToolBar *toolBar = new QToolBar( this );

        QToolButton *btnLoad = new QToolButton( toolBar );

        btnLoad->setText( "Load SVG" );
        btnLoad->setToolButtonStyle( Qt::ToolButtonTextUnderIcon );
        toolBar->addWidget( btnLoad );

        addToolBar( toolBar );

        connect( btnLoad, SIGNAL( clicked() ), plot, SLOT( loadSVG() ) );
#endif
    }
};

int main( int argc, char **argv )
{
    QApplication a( argc, argv );

    QString fileName;
    if ( argc > 1 )
        fileName = argv[1];

    MainWindow w( fileName );
    w.resize( 600, 400 );
    w.show();

    int rv = a.exec();
    return rv;
}