1
#include <qapplication.h>
2
#include <qmainwindow.h>
4
#include <qtoolbutton.h>
7
class MainWindow: public QMainWindow
10
MainWindow(QWidget * = NULL);
16
MainWindow::MainWindow(QWidget *parent):
19
d_plot = new Plot(this);
21
setCentralWidget(d_plot);
23
QToolBar *toolBar = new QToolBar(this);
25
QToolButton *btnSpectrogram = new QToolButton(toolBar);
26
QToolButton *btnContour = new QToolButton(toolBar);
27
QToolButton *btnPrint = new QToolButton(toolBar);
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);
36
btnContour->setText("Contour");
37
//btnContour->setIcon(QIcon());
38
btnContour->setCheckable(true);
39
btnContour->setToolButtonStyle(Qt::ToolButtonTextUnderIcon);
40
toolBar->addWidget(btnContour);
42
btnPrint->setText("Print");
43
btnPrint->setToolButtonStyle(Qt::ToolButtonTextUnderIcon);
44
toolBar->addWidget(btnPrint);
46
btnSpectrogram->setTextLabel("Spectrogram");
47
//btnSpectrogram->setPixmap(zoom_xpm);
48
btnSpectrogram->setToggleButton(true);
49
btnSpectrogram->setUsesTextLabel(true);
51
btnContour->setTextLabel("Contour");
52
//btnContour->setPixmap(zoom_xpm);
53
btnContour->setToggleButton(true);
54
btnContour->setUsesTextLabel(true);
56
btnPrint->setTextLabel("Print");
57
btnPrint->setUsesTextLabel(true);
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()) );
69
#if QT_VERSION >= 0x040000
70
btnSpectrogram->setChecked(true);
71
btnContour->setChecked(false);
73
btnSpectrogram->setOn(true);
74
btnContour->setOn(false);
78
int main(int argc, char **argv)
80
QApplication a(argc, argv);
82
MainWindow mainWindow;
83
#if QT_VERSION < 0x040000
84
a.setMainWidget(&mainWindow);
87
mainWindow.resize(600,400);