1
#include <qapplication.h>
2
#include <qmainwindow.h>
5
#include <qtextstream.h>
7
#include <qtoolbutton.h>
10
class MainWindow: public QMainWindow
13
MainWindow( QWidget * = NULL );
19
MainWindow::MainWindow( QWidget *parent ):
22
d_plot = new Plot( this );
23
setCentralWidget( d_plot );
25
QToolBar *toolBar = new QToolBar( this );
27
QComboBox *typeBox = new QComboBox( toolBar );
28
typeBox->addItem( "Bars" );
29
typeBox->addItem( "Tube" );
30
typeBox->setCurrentIndex( 1 );
31
typeBox->setSizePolicy( QSizePolicy::Fixed, QSizePolicy::Fixed );
33
QToolButton *btnExport = new QToolButton( toolBar );
34
btnExport->setText( "Export" );
35
btnExport->setToolButtonStyle( Qt::ToolButtonTextUnderIcon );
36
connect( btnExport, SIGNAL( clicked() ), d_plot, SLOT( exportPlot() ) );
38
toolBar->addWidget( typeBox );
39
toolBar->addWidget( btnExport );
40
addToolBar( toolBar );
42
d_plot->setMode( typeBox->currentIndex() );
43
connect( typeBox, SIGNAL( currentIndexChanged( int ) ),
44
d_plot, SLOT( setMode( int ) ) );
47
int main( int argc, char **argv )
49
QApplication a( argc, argv );
52
w.setObjectName( "MainWindow" );