0
|
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 |
\example activeqt/webbrowser
|
|
44 |
\title Web Browser Example (ActiveQt)
|
|
45 |
|
|
46 |
The Web Browser example uses the Microsoft Web Browser
|
|
47 |
ActiveX control to implement a fully functional Web Browser
|
|
48 |
application. The user interface has been developed using the Qt
|
|
49 |
Designer integration of the QAxWidget class.
|
|
50 |
|
|
51 |
The code demonstrates how the Qt application can communicate
|
|
52 |
with the embedded ActiveX controls using signals, slots and the
|
|
53 |
dynamicCall() function.
|
|
54 |
|
|
55 |
\snippet examples/activeqt/webbrowser/main.cpp 0
|
|
56 |
|
|
57 |
The \c MainWindow class declares a \c QMainWindow based user interface,
|
|
58 |
using the \c Ui::MainWindow class generated by Qt Designer. A number
|
|
59 |
of slots are implemented to handle events from the various user
|
|
60 |
interface elements, including the \c WebBrowser object, which is a
|
|
61 |
QAxWidget hosting the Microsoft Web Browser control.
|
|
62 |
|
|
63 |
\snippet examples/activeqt/webbrowser/main.cpp 1
|
|
64 |
|
|
65 |
The constructor initializes the user interface, installs a
|
|
66 |
progress bar on the status bar, and uses QAxBase::dynamicCall()
|
|
67 |
to invoke the \c GoHome() method of Internet Explorer to
|
|
68 |
navigate to the user's home page.
|
|
69 |
|
|
70 |
\snippet examples/activeqt/webbrowser/main.cpp 2
|
|
71 |
Different slots handle the signals emitted by the WebBrowser object.
|
|
72 |
|
|
73 |
Connections that don't require any coding, i.e. connecting the \c back
|
|
74 |
action to the \c GoBack() slot, have already been made in Qt Designer.
|
|
75 |
|
|
76 |
\snippet examples/activeqt/webbrowser/main.cpp 3
|
|
77 |
\snippet examples/activeqt/webbrowser/main.cpp 4
|
|
78 |
|
|
79 |
The rest of the implementation is not related to ActiveQt - the actions
|
|
80 |
are handled by different slots, and the entry point function starts the
|
|
81 |
application using standard Qt APIs.
|
|
82 |
|
|
83 |
To build the example you must first build the QAxContainer
|
|
84 |
library. Then run your make tool in \c
|
|
85 |
examples/activeqt/webbrowser and run the resulting \c
|
|
86 |
webbrowser.exe.
|
|
87 |
*/
|