doc/src/examples/activeqt/hierarchy.qdoc
changeset 0 1918ee327afb
equal deleted inserted replaced
-1:000000000000 0:1918ee327afb
       
     1 /****************************************************************************
       
     2 **
       
     3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
       
     4 ** All rights reserved.
       
     5 ** Contact: Nokia Corporation (qt-info@nokia.com)
       
     6 **
       
     7 ** This file is part of the documentation of the Qt Toolkit.
       
     8 **
       
     9 ** $QT_BEGIN_LICENSE:LGPL$
       
    10 ** No Commercial Usage
       
    11 ** This file contains pre-release code and may not be distributed.
       
    12 ** You may use this file in accordance with the terms and conditions
       
    13 ** contained in the Technology Preview License Agreement accompanying
       
    14 ** this package.
       
    15 **
       
    16 ** GNU Lesser General Public License Usage
       
    17 ** Alternatively, this file may be used under the terms of the GNU Lesser
       
    18 ** General Public License version 2.1 as published by the Free Software
       
    19 ** Foundation and appearing in the file LICENSE.LGPL included in the
       
    20 ** packaging of this file.  Please review the following information to
       
    21 ** ensure the GNU Lesser General Public License version 2.1 requirements
       
    22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
       
    23 **
       
    24 ** In addition, as a special exception, Nokia gives you certain additional
       
    25 ** rights.  These rights are described in the Nokia Qt LGPL Exception
       
    26 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
       
    27 **
       
    28 ** If you have questions regarding the use of this file, please contact
       
    29 ** Nokia at qt-info@nokia.com.
       
    30 **
       
    31 **
       
    32 **
       
    33 **
       
    34 **
       
    35 **
       
    36 **
       
    37 **
       
    38 ** $QT_END_LICENSE$
       
    39 **
       
    40 ****************************************************************************/
       
    41 
       
    42 /*! 
       
    43     \page qaxserver-demo-hierarchy.html
       
    44     \title Qt Widget Hierarchy
       
    45 
       
    46     \input examples/activeqt/hierarchy-demo.qdocinc
       
    47 */
       
    48 
       
    49 /*!
       
    50     \example activeqt/hierarchy
       
    51     \title Hierarchy Example (ActiveQt)
       
    52 
       
    53     The Hierarchy example is shows how to write an in-process ActiveX
       
    54     control. The control is a QWidget subclass with child widgets
       
    55     that are accessible as sub-types.
       
    56 
       
    57     \snippet examples/activeqt/hierarchy/objects.h 0
       
    58     The \c QParentWidget class provides slots to create a widget
       
    59     with a name, and to return a pointer to a named widget. The class
       
    60     declaration uses \c Q_CLASSINFO() to provide the COM identifiers for
       
    61     this class.
       
    62 
       
    63     \snippet examples/activeqt/hierarchy/objects.cpp 0
       
    64     The constructor of QParentWidget creates a vertical box layout.
       
    65     New child widgets are automatically added to the layout.
       
    66 
       
    67     \snippet examples/activeqt/hierarchy/objects.cpp 1
       
    68     The \c createSubWidget slot creates a new \c QSubWidget with
       
    69     the name provided in the parameter, and sets the label to that
       
    70     name. The widget is also shown explicitly.
       
    71 
       
    72     \snippet examples/activeqt/hierarchy/objects.cpp 2
       
    73     The \c subWidget slot uses the \c QObject::child() function and
       
    74     returns the first child of type \c QSubWidget that has the requested
       
    75     name.
       
    76 
       
    77      \snippet examples/activeqt/hierarchy/objects.h 1
       
    78     The \c QSubWidget class has a single string-property \c label,
       
    79     and implements the paintEvent to draw the label. The class uses
       
    80     again \c Q_CLASSINFO to provide the COM identifiers, and also sets
       
    81     the \e ToSuperClass attribute to \e QSubWidget, to ensure that only
       
    82     no slots of any superclasses (i.e. QWidget) are exposed.
       
    83 
       
    84     \snippet examples/activeqt/hierarchy/objects.cpp 3
       
    85     \snippet examples/activeqt/hierarchy/objects.cpp 4
       
    86     The implementation of the QSubWidget class is self-explanatory.
       
    87 
       
    88     \snippet examples/activeqt/hierarchy/main.cpp 0
       
    89     The classes are then exported using a QAxFactory. \c QParentWidget is
       
    90     exported as a full class (which can be created ), while \c QSubWidget is
       
    91     only exported as a type, which can only be created indirectly through
       
    92     APIs of \c QParentWidget.
       
    93 
       
    94     To build the example you must first build the QAxServer library.
       
    95     Then run qmake and your make tool in \c examples/activeqt/hierarchy.
       
    96 
       
    97     The \l{qaxserver-demo-hierarchy.html}{demonstration} requires
       
    98     your WebBrowser to support ActiveX controls, and scripting to be
       
    99     enabled.
       
   100 
       
   101     \snippet examples/activeqt/hierarchy-demo.qdocinc 0
       
   102 */