Last change
on this file since 244 was 2, checked in by Dmitry A. Kuminov, 16 years ago |
Initially imported qt-all-opensource-src-4.5.1 from Trolltech.
|
File size:
1.4 KB
|
Line | |
---|
1 | //! [0]
|
---|
2 | moc_%.cpp: %.h
|
---|
3 | moc $(DEFINES) $(INCPATH) $< -o $@
|
---|
4 | //! [0]
|
---|
5 |
|
---|
6 |
|
---|
7 | //! [1]
|
---|
8 | moc_foo.cpp: foo.h
|
---|
9 | moc $(DEFINES) $(INCPATH) $< -o $@
|
---|
10 | //! [1]
|
---|
11 |
|
---|
12 |
|
---|
13 | //! [2]
|
---|
14 | foo.o: foo.moc
|
---|
15 |
|
---|
16 | foo.moc: foo.cpp
|
---|
17 | moc $(DEFINES) $(INCPATH) -i $< -o $@
|
---|
18 | //! [2]
|
---|
19 |
|
---|
20 |
|
---|
21 | //! [3]
|
---|
22 | #include "foo.moc"
|
---|
23 | //! [3]
|
---|
24 |
|
---|
25 |
|
---|
26 | //! [4]
|
---|
27 | #ifndef Q_MOC_RUN
|
---|
28 | ...
|
---|
29 | #endif
|
---|
30 | //! [4]
|
---|
31 |
|
---|
32 |
|
---|
33 | //! [5]
|
---|
34 | class SomeTemplate<int> : public QFrame
|
---|
35 | {
|
---|
36 | Q_OBJECT
|
---|
37 | ...
|
---|
38 |
|
---|
39 | signals:
|
---|
40 | void mySignal(int);
|
---|
41 | };
|
---|
42 | //! [5]
|
---|
43 |
|
---|
44 |
|
---|
45 | //! [6]
|
---|
46 | // correct
|
---|
47 | class SomeClass : public QObject, public OtherClass
|
---|
48 | {
|
---|
49 | ...
|
---|
50 | };
|
---|
51 | //! [6]
|
---|
52 |
|
---|
53 |
|
---|
54 | //! [7]
|
---|
55 | class SomeClass : public QObject
|
---|
56 | {
|
---|
57 | Q_OBJECT
|
---|
58 |
|
---|
59 | public slots:
|
---|
60 | void apply(void (*apply)(List *, void *), char *); // WRONG
|
---|
61 | };
|
---|
62 | //! [7]
|
---|
63 |
|
---|
64 |
|
---|
65 | //! [8]
|
---|
66 | typedef void (*ApplyFunction)(List *, void *);
|
---|
67 |
|
---|
68 | class SomeClass : public QObject
|
---|
69 | {
|
---|
70 | Q_OBJECT
|
---|
71 |
|
---|
72 | public slots:
|
---|
73 | void apply(ApplyFunction, char *);
|
---|
74 | };
|
---|
75 | //! [8]
|
---|
76 |
|
---|
77 |
|
---|
78 | //! [9]
|
---|
79 | class MyClass : public QObject
|
---|
80 | {
|
---|
81 | Q_OBJECT
|
---|
82 |
|
---|
83 | enum Error {
|
---|
84 | ConnectionRefused,
|
---|
85 | RemoteHostClosed,
|
---|
86 | UnknownError
|
---|
87 | };
|
---|
88 |
|
---|
89 | signals:
|
---|
90 | void stateChanged(MyClass::Error error);
|
---|
91 | };
|
---|
92 | //! [9]
|
---|
93 |
|
---|
94 |
|
---|
95 | //! [10]
|
---|
96 | #ifdef ultrix
|
---|
97 | #define SIGNEDNESS(a) unsigned a
|
---|
98 | #else
|
---|
99 | #define SIGNEDNESS(a) a
|
---|
100 | #endif
|
---|
101 |
|
---|
102 | class Whatever : public QObject
|
---|
103 | {
|
---|
104 | Q_OBJECT
|
---|
105 |
|
---|
106 | signals:
|
---|
107 | void someSignal(SIGNEDNESS(int));
|
---|
108 | };
|
---|
109 | //! [10]
|
---|
110 |
|
---|
111 |
|
---|
112 | //! [11]
|
---|
113 | class A
|
---|
114 | {
|
---|
115 | public:
|
---|
116 | class B
|
---|
117 | {
|
---|
118 | Q_OBJECT
|
---|
119 |
|
---|
120 | public slots: // WRONG
|
---|
121 | void b();
|
---|
122 | };
|
---|
123 | };
|
---|
124 | //! [11]
|
---|
Note:
See
TracBrowser
for help on using the repository browser.