-rw-r--r-- | examples/simple/simple.h | 66 |
1 files changed, 66 insertions, 0 deletions
diff --git a/examples/simple/simple.h b/examples/simple/simple.h new file mode 100644 index 0000000..63611bb --- a/dev/null +++ b/examples/simple/simple.h | |||
@@ -0,0 +1,66 @@ | |||
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 <qwidget.h> // from this class we will inherit | ||
19 | |||
20 | class QPushButton; // forward declaration to not include the header. This can save time when compiling | ||
21 | |||
22 | |||
23 | /* | ||
24 | * Simple inherits from QWidget | ||
25 | */ | ||
26 | class Simple : public QWidget { | ||
27 | /* | ||
28 | * Q_OBJECT must always be the first thing you include | ||
29 | * This is a macro and is responsible for the concepts of | ||
30 | * dynamic signal and slots and other MetaObjects as | ||
31 | * superClass(), inherits(), isA()... | ||
32 | * If you use multiple inheritance include the class derived | ||
33 | * from QObject first | ||
34 | */ | ||
35 | Q_OBJECT | ||
36 | public: | ||
37 | /* | ||
38 | * C'tor for the Simple | ||
39 | * make sure to always have these three when you use | ||
40 | * the quicklaunch factory ( explained in the implementation ) | ||
41 | */ | ||
42 | Simple( QWidget* parent = 0, const char * name = 0, WFlags fl = 0 ); | ||
43 | ~Simple(); | ||
44 | |||
45 | /* | ||
46 | * appName is used by the Application factory. | ||
47 | * make sure the name matches the one of the executable | ||
48 | */ | ||
49 | static QString appName() { return QString::fromLatin1("simple"); } | ||
50 | |||
51 | /* | ||
52 | * use private slots: to mark your slots as such | ||
53 | * A slot can also be called as a normal method | ||
54 | */ | ||
55 | private slots: | ||
56 | void slotQuit(); | ||
57 | |||
58 | private: | ||
59 | /* my variable */ | ||
60 | QPushButton* m_button; | ||
61 | }; | ||
62 | |||
63 | |||
64 | |||
65 | |||
66 | #endif | ||