source: trunk/doc/src/snippets/code/doc_src_qt4-intro.qdoc@ 244

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.2 KB
Line 
1//! [0]
2QT -= gui
3//! [0]
4
5
6//! [1]
7QT += network opengl sql qt3support
8//! [1]
9
10
11//! [2]
12CONFIG += uic3
13//! [2]
14
15
16//! [3]
17#include <QClassName>
18//! [3]
19
20
21//! [4]
22#include <QString>
23#include <QApplication>
24#include <QSqlTableModel>
25//! [4]
26
27
28//! [5]
29#include <qclassname.h>
30//! [5]
31
32
33//! [6]
34#include <QtCore>
35//! [6]
36
37
38//! [7]
39using namespace Qt;
40//! [7]
41
42
43//! [8]
44QLabel *label1 = new QLabel("Hello", this);
45QLabel *label2 = new QLabel(this, "Hello");
46//! [8]
47
48
49//! [9]
50MyWidget::MyWidget(QWidget *parent, const char *name)
51 : QWidget(parent, name)
52{
53 ...
54}
55//! [9]
56
57
58//! [10]
59// DEPRECATED
60if (obj->inherits("QPushButton")) {
61 QPushButton *pushButton = (QPushButton *)obj;
62 ...
63}
64//! [10]
65
66
67//! [11]
68QPushButton *pushButton = qobject_cast<QPushButton *>(obj);
69if (pushButton) {
70 ...
71}
72//! [11]
73
74
75//! [12]
76QLabel *label = new QLabel;
77QPointer<QLabel> safeLabel = label;
78safeLabel->setText("Hello world!");
79delete label;
80// safeLabel is now 0, whereas label is a dangling pointer
81//! [12]
82
83
84//! [13]
85QT += qt3support
86//! [13]
87
88
89//! [14]
90DEFINES += QT3_SUPPORT
91//! [14]
92
93
94//! [15]
95DEFINES += QT3_SUPPORT_WARNINGS
96//! [15]
97
98
99//! [16]
100DEFINES += QT3_SUPPORT
101//! [16]
Note: See TracBrowser for help on using the repository browser.