~ubuntu-branches/ubuntu/oneiric/qwt/oneiric-proposed

« back to all changes in this revision

Viewing changes to qwt-5.1.1/examples/event_filter/event_filter.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Fathi Boudra
  • Date: 2009-04-12 23:25:58 UTC
  • mfrom: (1.1.4 upstream) (2.1.2 squeeze)
  • Revision ID: james.westby@ubuntu.com-20090412232558-3bl06x785yr8xm8u
Tags: 5.1.2-1
* New upstream release.
* Bump compat/debhelper to 7.
* Bump Standards-Version to 3.8.1. No changes needed.
* Invert Maintainers and Uploaders field.
* Fix lintian warnings:
  - dh_clean _k deprecated.
  - missing dependency on libc.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
//-----------------------------------------------------------------
2
 
//      A demo program showing how to use event filtering
3
 
//-----------------------------------------------------------------
4
 
 
5
 
#include <qapplication.h>
6
 
#include <qmainwindow.h>
7
 
#include <qwhatsthis.h>
8
 
#include <qtoolbar.h>
9
 
#include <qtoolbutton.h>
10
 
#include "plot.h"
11
 
#include "canvaspicker.h"
12
 
#include "scalepicker.h"
13
 
 
14
 
int main (int argc, char **argv)
15
 
{
16
 
    QApplication a(argc, argv);
17
 
 
18
 
    QMainWindow mainWindow;
19
 
    QToolBar *toolBar = new QToolBar(&mainWindow);
20
 
#if QT_VERSION >= 0x040000
21
 
    QAction *action = QWhatsThis::createAction(toolBar);
22
 
    toolBar->addAction(action);
23
 
    mainWindow.addToolBar(toolBar);
24
 
#else
25
 
    (void)QWhatsThis::whatsThisButton(toolBar);
26
 
#endif
27
 
    
28
 
    Plot *plot = new Plot(&mainWindow);
29
 
 
30
 
    // The canvas picker handles all mouse and key
31
 
    // events on the plot canvas
32
 
 
33
 
    (void) new CanvasPicker(plot);
34
 
 
35
 
    // The scale picker translates mouse clicks
36
 
    // int o clicked() signals
37
 
 
38
 
    ScalePicker *scalePicker = new ScalePicker(plot);
39
 
    a.connect(scalePicker, SIGNAL(clicked(int, double)),
40
 
        plot, SLOT(insertCurve(int, double)));
41
 
 
42
 
    mainWindow.setCentralWidget(plot);
43
 
#if QT_VERSION < 0x040000
44
 
    a.setMainWidget(&mainWindow);
45
 
#endif
46
 
 
47
 
    mainWindow.resize(540, 400);
48
 
    mainWindow.show();
49
 
 
50
 
    const char *text =
51
 
        "An useless plot to demonstrate how to use event filtering.\n\n"
52
 
        "You can click on the color bar, the scales or move the wheel.\n"
53
 
        "All points can be moved using the mouse or the keyboard.";
54
 
#if QT_VERSION < 0x040000
55
 
    QWhatsThis::add(plot, text);
56
 
#else
57
 
    plot->setWhatsThis(text);
58
 
#endif
59
 
 
60
 
    int rv = a.exec();
61
 
    return rv;
62
 
}