File: main.cpp

package info (click to toggle)
qwt5 5.2.2-3
  • links: PTS
  • area: main
  • in suites: wheezy
  • size: 13,340 kB
  • sloc: cpp: 32,645; makefile: 23; sh: 4
file content (48 lines) | stat: -rw-r--r-- 1,022 bytes parent folder | download | duplicates (6)
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
#include <qapplication.h>
#include <qmainwindow.h>
#include <qtoolbar.h>
#include <qtoolbutton.h>
#include "plot.h"

class MainWindow: public QMainWindow
{
public:
    MainWindow(QWidget *parent = NULL):
        QMainWindow(parent)
    {   
        Plot *plot = new Plot(this);
        setCentralWidget(plot);

        QToolBar *toolBar = new QToolBar(this);

        QToolButton *btnLoad = new QToolButton(toolBar);
        
#if QT_VERSION >= 0x040000
        btnLoad->setText("Load SVG");
        btnLoad->setToolButtonStyle(Qt::ToolButtonTextUnderIcon);
        toolBar->addWidget(btnLoad);
#else
        btnLoad->setTextLabel("Load SVG");
        btnLoad->setUsesTextLabel(true);
#endif

        addToolBar(toolBar);

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

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

    MainWindow w;
#if QT_VERSION < 0x040000
    a.setMainWidget(&w);
#endif
    w.resize(600,400);
    w.show();

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