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

« back to all changes in this revision

Viewing changes to qwt-5.1.1/examples/data_plot/main.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Fathi Boudra
  • Date: 2008-05-26 10:26:31 UTC
  • mfrom: (1.1.3 upstream) (2.1.1 lenny)
  • Revision ID: james.westby@ubuntu.com-20080526102631-bp95mfccnrb957nx
Tags: 5.1.1-1
New upstream release.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#include <qapplication.h>
 
2
#include <qmainwindow.h>
 
3
#include <qwt_counter.h>
 
4
#include <qtoolbar.h>
 
5
#include <qlabel.h>
 
6
#include <qlayout.h>
 
7
#include "data_plot.h"
 
8
 
 
9
class MainWindow: public QMainWindow
 
10
{
 
11
public:
 
12
    MainWindow()
 
13
    {
 
14
        QToolBar *toolBar = new QToolBar(this);
 
15
        toolBar->setFixedHeight(80);
 
16
 
 
17
#if QT_VERSION < 0x040000
 
18
        setDockEnabled(TornOff, true);
 
19
        setRightJustification(true);
 
20
#else
 
21
        toolBar->setAllowedAreas(Qt::TopToolBarArea | Qt::BottomToolBarArea);
 
22
#endif
 
23
        QWidget *hBox = new QWidget(toolBar);
 
24
        QLabel *label = new QLabel("Timer Interval", hBox);
 
25
        QwtCounter *counter = new QwtCounter(hBox);
 
26
        counter->setRange(-1.0, 100.0, 1.0);
 
27
 
 
28
        QHBoxLayout *layout = new QHBoxLayout(hBox);
 
29
        layout->addWidget(label);
 
30
        layout->addWidget(counter);
 
31
        layout->addWidget(new QWidget(hBox), 10); // spacer);
 
32
 
 
33
#if QT_VERSION >= 0x040000
 
34
        toolBar->addWidget(hBox);
 
35
#endif
 
36
        addToolBar(toolBar);
 
37
 
 
38
 
 
39
        DataPlot *plot = new DataPlot(this);
 
40
        setCentralWidget(plot);
 
41
 
 
42
        connect(counter, SIGNAL(valueChanged(double)),
 
43
            plot, SLOT(setTimerInterval(double)) );
 
44
 
 
45
        counter->setValue(20.0);
 
46
    }
 
47
};
 
48
 
 
49
int main(int argc, char **argv)
 
50
{
 
51
    QApplication a(argc, argv);
 
52
 
 
53
    MainWindow mainWindow;
 
54
#if QT_VERSION < 0x040000
 
55
    a.setMainWidget(&mainWindow);
 
56
#endif
 
57
 
 
58
    mainWindow.resize(600,400);
 
59
    mainWindow.show();
 
60
 
 
61
    return a.exec(); 
 
62
}