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

« back to all changes in this revision

Viewing changes to qwt-5.1.1/examples/spectrogram/main.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
 
#include <qapplication.h>
2
 
#include <qmainwindow.h>
3
 
#include <qtoolbar.h>
4
 
#include <qtoolbutton.h>
5
 
#include "plot.h"
6
 
 
7
 
class MainWindow: public QMainWindow
8
 
{
9
 
public:
10
 
    MainWindow(QWidget * = NULL);
11
 
 
12
 
private:
13
 
    Plot *d_plot;
14
 
};
15
 
 
16
 
MainWindow::MainWindow(QWidget *parent):
17
 
    QMainWindow(parent)
18
 
{
19
 
    d_plot = new Plot(this);
20
 
 
21
 
    setCentralWidget(d_plot);
22
 
 
23
 
    QToolBar *toolBar = new QToolBar(this);
24
 
 
25
 
    QToolButton *btnSpectrogram = new QToolButton(toolBar);
26
 
    QToolButton *btnContour = new QToolButton(toolBar);
27
 
    QToolButton *btnPrint = new QToolButton(toolBar);
28
 
 
29
 
#if QT_VERSION >= 0x040000
30
 
    btnSpectrogram->setText("Spectrogram");
31
 
    //btnSpectrogram->setIcon(QIcon());
32
 
    btnSpectrogram->setCheckable(true);
33
 
    btnSpectrogram->setToolButtonStyle(Qt::ToolButtonTextUnderIcon);
34
 
    toolBar->addWidget(btnSpectrogram);
35
 
 
36
 
    btnContour->setText("Contour");
37
 
    //btnContour->setIcon(QIcon());
38
 
    btnContour->setCheckable(true);
39
 
    btnContour->setToolButtonStyle(Qt::ToolButtonTextUnderIcon);
40
 
    toolBar->addWidget(btnContour);
41
 
 
42
 
    btnPrint->setText("Print");
43
 
    btnPrint->setToolButtonStyle(Qt::ToolButtonTextUnderIcon);
44
 
    toolBar->addWidget(btnPrint);
45
 
#else
46
 
    btnSpectrogram->setTextLabel("Spectrogram");
47
 
    //btnSpectrogram->setPixmap(zoom_xpm);
48
 
    btnSpectrogram->setToggleButton(true);
49
 
    btnSpectrogram->setUsesTextLabel(true);
50
 
 
51
 
    btnContour->setTextLabel("Contour");
52
 
    //btnContour->setPixmap(zoom_xpm);
53
 
    btnContour->setToggleButton(true);
54
 
    btnContour->setUsesTextLabel(true);
55
 
 
56
 
    btnPrint->setTextLabel("Print");
57
 
    btnPrint->setUsesTextLabel(true);
58
 
#endif
59
 
 
60
 
    addToolBar(toolBar);
61
 
 
62
 
    connect(btnSpectrogram, SIGNAL(toggled(bool)), 
63
 
        d_plot, SLOT(showSpectrogram(bool)));
64
 
    connect(btnContour, SIGNAL(toggled(bool)), 
65
 
        d_plot, SLOT(showContour(bool)));
66
 
    connect(btnPrint, SIGNAL(clicked()), 
67
 
        d_plot, SLOT(printPlot()) );
68
 
 
69
 
#if QT_VERSION >= 0x040000
70
 
    btnSpectrogram->setChecked(true);
71
 
    btnContour->setChecked(false);
72
 
#else
73
 
    btnSpectrogram->setOn(true);
74
 
    btnContour->setOn(false);
75
 
#endif
76
 
}
77
 
 
78
 
int main(int argc, char **argv)
79
 
{
80
 
    QApplication a(argc, argv);
81
 
 
82
 
    MainWindow mainWindow;
83
 
#if QT_VERSION < 0x040000
84
 
    a.setMainWidget(&mainWindow);
85
 
#endif
86
 
 
87
 
    mainWindow.resize(600,400);
88
 
    mainWindow.show();
89
 
 
90
 
    return a.exec(); 
91
 
}