summaryrefslogtreecommitdiff
path: root/examples/main-tab/simple.cpp
Unidiff
Diffstat (limited to 'examples/main-tab/simple.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--examples/main-tab/simple.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/examples/main-tab/simple.cpp b/examples/main-tab/simple.cpp
index 69dd00f..c5a6d5a 100644
--- a/examples/main-tab/simple.cpp
+++ b/examples/main-tab/simple.cpp
@@ -1,91 +1,91 @@
1#include <qaction.h> // action 1#include <qaction.h> // action
2#include <qmenubar.h> // menubar 2#include <qmenubar.h> // menubar
3#include <qtoolbar.h> // toolbar 3#include <qtoolbar.h> // toolbar
4#include <qlabel.h> // a label 4#include <qlabel.h> // a label
5#include <qpushbutton.h> // the header file for the QPushButton 5#include <qpushbutton.h> // the header file for the QPushButton
6#include <qlayout.h> 6#include <qlayout.h>
7 7
8#include <qpe/qpeapplication.h> // the QPEApplication 8#include <qpe/qpeapplication.h> // the QPEApplication
9#include <qpe/resource.h> 9#include <qpe/resource.h>
10#include <qpe/sound.h> 10#include <qpe/sound.h>
11 11
12#include <opie/oapplicationfactory.h> // a template + macro to save the main method and allow quick launching 12#include <opie/oapplicationfactory.h> // a template + macro to save the main method and allow quick launching
13#include <opie/otabwidget.h> 13#include <opie/otabwidget.h>
14 14
15#include "simple.h" 15#include "simple.h"
16 16
17/* 17/*
18 * implementation of simple 18 * implementation of simple
19 */ 19 */
20 20
21/* 21/*
22 * The factory is used for quicklaunching 22 * The factory is used for quicklaunching
23 * It needs a constructor ( c'tor ) with at least QWidget, const char* and WFlags as parameter and a static QString appName() matching the TARGET of the .pro 23 * It needs a constructor ( c'tor ) with at least QWidget, const char* and WFlags as parameter and a static QString appName() matching the TARGET of the .pro
24 * 24 *
25 * Depending on the global quick launch setting this will create 25 * Depending on the global quick launch setting this will create
26 * either a main method or one for our component plugin system 26 * either a main method or one for our component plugin system
27 */ 27 */
28 28
29OPIE_EXPORT_APP( OApplicationFactory<MainWindow> ) 29OPIE_EXPORT_APP( OApplicationFactory<MainWindow> )
30 30
31MainWindow::MainWindow(QWidget *parent, const char* name, WFlags fl ) 31MainWindow::MainWindow(QWidget *parent, const char* name, WFlags fl )
32 : QMainWindow( parent, name, fl ) { 32 : QMainWindow( parent, name, fl ) {
33 setCaption(tr("My MainWindow") ); 33 setCaption(tr("My MainWindow") );
34 34
35 initUI(); 35 initUI();
36 36
37 37
38 /* 38 /*
39 * Tab widget as central 39 * Tab widget as central
40 */ 40 */
41 OTabWidget *tab = new OTabWidget(this); 41 OTabWidget *tab = new OTabWidget(this);
42 connect(tab, SIGNAL(currentChanged(QWidget*) ), 42 connect(tab, SIGNAL(currentChanged(QWidget*) ),
43 this, SLOT( slotCurrentChanged( QWidget* ) ) ); 43 this, SLOT( slotCurrentChanged(QWidget*) ) );
44 setCentralWidget( tab ); 44 setCentralWidget( tab );
45 45
46 Simple1 *simple1 = new Simple1( this ); 46 Simple1 *simple1 = new Simple1( this );
47 tab->addTab( simple1, "new", tr("Simple1") ); 47 tab->addTab( simple1, "new", tr("Simple1") );
48 tab->setCurrentTab( tr("Simple1") ); 48 tab->setCurrentTab( tr("Simple1") );
49 49
50 Simple2 *simple2 = new Simple2( this ); 50 Simple2 *simple2 = new Simple2( this );
51 tab->addTab( simple2, "trash", tr("Simple2") ); 51 tab->addTab( simple2, "trash", tr("Simple2") );
52 52
53 m_oldCurrent = simple1; 53 m_oldCurrent = simple1;
54 54
55 connect(m_fire, SIGNAL(activated() ), 55 connect(m_fire, SIGNAL(activated() ),
56 simple1, SLOT(slotFire() ) ); 56 simple1, SLOT(slotFire() ) );
57} 57}
58 58
59MainWindow::~MainWindow() { 59MainWindow::~MainWindow() {
60 // again nothing to delete because Qt takes care 60 // again nothing to delete because Qt takes care
61} 61}
62 62
63 63
64void MainWindow::setDocument( const QString& /*str*/ ) { 64void MainWindow::setDocument( const QString& /*str*/ ) {
65} 65}
66void MainWindow::slotCurrentChanged( QWidget *wid) { 66void MainWindow::slotCurrentChanged( QWidget *wid) {
67 disconnect(m_fire, SIGNAL(activated() ), 67 disconnect(m_fire, SIGNAL(activated() ),
68 m_oldCurrent, SLOT(slotFire() ) ); 68 m_oldCurrent, SLOT(slotFire() ) );
69 connect(m_fire, SIGNAL(activated() ), 69 connect(m_fire, SIGNAL(activated() ),
70 wid, SLOT(slotFire() ) ); 70 wid, SLOT(slotFire() ) );
71 71
72 m_oldCurrent = wid; 72 m_oldCurrent = wid;
73} 73}
74 74
75void MainWindow::initUI() { 75void MainWindow::initUI() {
76 76
77 setToolBarsMovable( false ); 77 setToolBarsMovable( false );
78 78
79 QToolBar *menuBarHolder = new QToolBar( this ); 79 QToolBar *menuBarHolder = new QToolBar( this );
80 80
81 menuBarHolder->setHorizontalStretchable( true ); 81 menuBarHolder->setHorizontalStretchable( true );
82 QMenuBar *mb = new QMenuBar( menuBarHolder ); 82 QMenuBar *mb = new QMenuBar( menuBarHolder );
83 QToolBar *tb = new QToolBar( this ); 83 QToolBar *tb = new QToolBar( this );
84 84
85 QPopupMenu *fileMenu = new QPopupMenu( this ); 85 QPopupMenu *fileMenu = new QPopupMenu( this );
86 86
87 87
88 QAction *a = new QAction( tr("Quit"), Resource::loadIconSet("quit_icon"), 88 QAction *a = new QAction( tr("Quit"), Resource::loadIconSet("quit_icon"),
89 QString::null, 0, this, "quit_action" ); 89 QString::null, 0, this, "quit_action" );
90 /* 90 /*
91 * Connect quit to the QApplication quit slot 91 * Connect quit to the QApplication quit slot