author | zecke <zecke> | 2003-08-30 20:23:05 (UTC) |
---|---|---|
committer | zecke <zecke> | 2003-08-30 20:23:05 (UTC) |
commit | 4c3a1de5289631db05b86a07092f0a334608dcf6 (patch) (unidiff) | |
tree | 90caf9b05312013006dad0af7f039ed1c595842d /examples/simple-main/simple.h | |
parent | cc1e68e0b6e0677e0523382daeb12d60ba0b67c9 (diff) | |
download | opie-4c3a1de5289631db05b86a07092f0a334608dcf6.zip opie-4c3a1de5289631db05b86a07092f0a334608dcf6.tar.gz opie-4c3a1de5289631db05b86a07092f0a334608dcf6.tar.bz2 |
Add four examples
#1 simple widget + OApplicationFactory + qmake usage explained
#2 simple icons + usage of Resource and playing of sounds
#3 simple main + Toolbar + MenuBar IconSets and QActions explained
#4 main tab + Usage of OTabWidget and QSignals with parameters disconnect and connect
TODO
#5 PIM loading and viewing
#6 PIM qcop + usage of QCOP
BuildSystem integration
Diffstat (limited to 'examples/simple-main/simple.h') (more/less context) (ignore whitespace changes)
-rw-r--r-- | examples/simple-main/simple.h | 81 |
1 files changed, 81 insertions, 0 deletions
diff --git a/examples/simple-main/simple.h b/examples/simple-main/simple.h new file mode 100644 index 0000000..f75066e --- a/dev/null +++ b/examples/simple-main/simple.h | |||
@@ -0,0 +1,81 @@ | |||
1 | |||
2 | /* | ||
3 | * A Simple widget with a button to quit | ||
4 | * | ||
5 | */ | ||
6 | |||
7 | /* | ||
8 | * The below sequence is called a guard and guards | ||
9 | * against multiple inclusion of header files | ||
10 | * NOTE: you need to use unique names among the header files | ||
11 | */ | ||
12 | #ifndef QUIET_SIMPLE_DEMO_H | ||
13 | #define QUIET_SIMPLE_DEMO_H | ||
14 | |||
15 | |||
16 | |||
17 | |||
18 | #include <qmainwindow.h> // from this class we will inherit | ||
19 | |||
20 | |||
21 | class QPushButton; // forward declaration to not include the header. This can save time when compiling | ||
22 | class QAction; | ||
23 | |||
24 | /* | ||
25 | * A mainwindow is a special QWidget it helps layouting | ||
26 | * toolbar, statusbar, menubar. Got dockable areas | ||
27 | * So in one sentence it is a MainWindow :) | ||
28 | */ | ||
29 | class MainWindow : public QMainWindow { | ||
30 | Q_OBJECT | ||
31 | public: | ||
32 | static QString appName() { return QString::fromLatin1("simple-main"); } | ||
33 | MainWindow( QWidget* parent, const char* name, WFlags fl ); | ||
34 | ~MainWindow(); | ||
35 | |||
36 | public slots: | ||
37 | void setDocument( const QString& ); | ||
38 | |||
39 | private: | ||
40 | void initUI(); | ||
41 | QAction *m_fire; | ||
42 | }; | ||
43 | |||
44 | |||
45 | /* | ||
46 | * Simple inherits from QWidget | ||
47 | */ | ||
48 | class Simple : public QWidget { | ||
49 | /* | ||
50 | * Q_OBJECT must always be the first thing you include | ||
51 | * This is a macro and is responsible for the concepts of | ||
52 | * dynamic signal and slots and other MetaObjects as | ||
53 | * superClass(), inherits(), isA()... | ||
54 | * If you use multiple inheritance include the class derived | ||
55 | * from QObject first | ||
56 | */ | ||
57 | Q_OBJECT | ||
58 | public: | ||
59 | /* | ||
60 | * C'tor for the Simple | ||
61 | * make sure to always have these three when you use | ||
62 | * the quicklaunch factory ( explained in the implementation ) | ||
63 | */ | ||
64 | Simple( QWidget* parent = 0, const char * name = 0, WFlags fl = 0 ); | ||
65 | ~Simple(); | ||
66 | |||
67 | /* | ||
68 | * We now make it public because our mainwindow wants to call it | ||
69 | */ | ||
70 | public slots: | ||
71 | void slotFire(); | ||
72 | |||
73 | private: | ||
74 | /* my variable */ | ||
75 | QPushButton* m_button; | ||
76 | }; | ||
77 | |||
78 | |||
79 | |||
80 | |||
81 | #endif | ||