From d796c9dd933ab96ec83b9a634feedd5d32e1ba3f Mon Sep 17 00:00:00 2001 From: Timothy Pearson Date: Tue, 8 Nov 2011 12:31:36 -0600 Subject: Test conversion to TQt3 from Qt3 8c6fc1f8e35fd264dd01c582ca5e7549b32ab731 --- doc/html/qaxcontainer-example-webbrowser.html | 128 ++++++++++++++++++++++++++ 1 file changed, 128 insertions(+) create mode 100644 doc/html/qaxcontainer-example-webbrowser.html (limited to 'doc/html/qaxcontainer-example-webbrowser.html') diff --git a/doc/html/qaxcontainer-example-webbrowser.html b/doc/html/qaxcontainer-example-webbrowser.html new file mode 100644 index 000000000..76f4b3a38 --- /dev/null +++ b/doc/html/qaxcontainer-example-webbrowser.html @@ -0,0 +1,128 @@ + + + + + +A Web Browser + + + + + + + +
+ +Home + | +All Classes + | +Main Classes + | +Annotated + | +Grouped Classes + | +Functions +

A Web Browser

+ + + +This example utilizes the Microsoft Web Browser ActiveX control +to implement a fully functional Web Browser application. The +user interface has been developed using the TQt Designer +integration of the TQAxWidget class. +

The code demonstrates how the TQt application can communicate +with the embedded ActiveX controls using signals, slots and the +dynamicCall() function. Most signal and slot connections have +already been set up within TQt Designer. +

+ +

    void MainWindow::init()
+    {
+        pb = new TQProgressBar( statusBar() );
+        pb->setPercentageVisible( FALSE );
+        pb->hide();
+        statusBar()->addWidget( pb, 0, TRUE );
+
+        connect( WebBrowser, SIGNAL(ProgressChange(int,int)), this, SLOT(setProgress(int,int)) );
+        connect( WebBrowser, SIGNAL(StatusTextChange(const TQString&)), statusBar(), SLOT(message(const TQString&)) );
+
+        WebBrowser->dynamicCall( "GoHome()" );
+    }
+
The init() function is implemented to create a progress bar as +the child of the status bar, and to connect Internet Explorer's +ProgressChange() and StatusTextChange() signals to the +respective displays. +

Finally the GoHome() function of Internet Explorer is invoked +using the TQAxBase::dynamicCall() dynamicCall() API. +

    void MainWindow::go()
+    {
+        actionStop->setEnabled( TRUE );
+        WebBrowser->dynamicCall( "Navigate(const TQString&)", addressEdit->text() );
+    }
+
The go() function calls the NavigateTo() function of Internet +Explorer, passing the text of the address bar as the argument. +

    void MainWindow::setTitle( const TQString &title )
+    {
+        setCaption( "TQt WebBrowser - " + title );
+    }
+
The setTitle() slot is connected to the TitleChange() signal +of Internet Explorer, and updates the caption of the window +using the provided title string. +

    void MainWindow::setProgress( int a, int b )
+    {
+        if ( a <= 0 || b <= 0 ) {
+            pb->hide();
+            return;
+        }
+        pb->show();
+        pb->setTotalSteps( b );
+        pb->setProgress( a );
+    }
+
+    void MainWindow::setCommandState( int cmd, bool on )
+    {
+        switch ( cmd ) {
+        case 1:
+            actionForward->setEnabled( on );
+            break;
+        case 2:
+            actionBack->setEnabled( on );
+            break;
+        }
+    }
+
+    void MainWindow::navigateBegin()
+    {
+        actionStop->setEnabled( TRUE );
+    }
+
+    void MainWindow::navigateComplete()
+    {
+        actionStop->setEnabled( FALSE );
+    }
+
The setProgress(), setCommandState(), navigateBegin() and +navigateComplete() slots are connected to the respective +signals of Internet Explorer and update the user interface. +

The rest of the implementation is not related to ActiveTQt and +omitted for brevity. +

To build the example you must first build the +TQAxContainer library. +Then run your make tool in examples/webbrowser and +run the resulting webbrowser.exe. +

See also The TQAxContainer Examples. + + +


+ +
Copyright © 2007 +TrolltechTrademarks +
TQt 3.3.8
+
+ -- cgit v1.2.1