/**************************************************************************** ** ** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). ** Contact: http://www.qt-project.org/legal ** ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and Digia. For licensing terms and ** conditions see http://qt.digia.com/licensing. For further information ** use the contact form at http://qt.digia.com/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser ** General Public License version 2.1 as published by the Free Software ** Foundation and appearing in the file LICENSE.LGPL included in the ** packaging of this file. Please review the following information to ** ensure the GNU Lesser General Public License version 2.1 requirements ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, Digia gives you certain additional ** rights. These rights are described in the Digia Qt LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** GNU General Public License Usage ** Alternatively, this file may be used under the terms of the GNU ** General Public License version 3.0 as published by the Free Software ** Foundation and appearing in the file LICENSE.GPL included in the ** packaging of this file. Please review the following information to ** ensure the GNU General Public License version 3.0 requirements will be ** met: http://www.gnu.org/copyleft/gpl.html. ** ** ** $QT_END_LICENSE$ ** ****************************************************************************/ //! [0] QT -= gui //! [0] //! [1] QT += network opengl sql qt3support //! [1] //! [2] CONFIG += uic3 //! [2] //! [3] #include //! [3] //! [4] #include #include #include //! [4] //! [5] #include //! [5] //! [6] #include //! [6] //! [7] using namespace Qt; //! [7] //! [8] QLabel *label1 = new QLabel("Hello", this); QLabel *label2 = new QLabel(this, "Hello"); //! [8] //! [9] MyWidget::MyWidget(QWidget *parent, const char *name) : QWidget(parent, name) { ... } //! [9] //! [10] // DEPRECATED if (obj->inherits("QPushButton")) { QPushButton *pushButton = (QPushButton *)obj; ... } //! [10] //! [11] QPushButton *pushButton = qobject_cast(obj); if (pushButton) { ... } //! [11] //! [12] QLabel *label = new QLabel; QPointer safeLabel = label; safeLabel->setText("Hello world!"); delete label; // safeLabel is now 0, whereas label is a dangling pointer //! [12] //! [13] QT += qt3support //! [13] //! [14] DEFINES += QT3_SUPPORT //! [14] //! [15] DEFINES += QT3_SUPPORT_WARNINGS //! [15] //! [16] DEFINES += QT3_SUPPORT //! [16]