PDA

View Full Version : Help Widget



navi1084
27th August 2008, 06:09
Hi,
I am new to Qt environment. I want to create a help dialog. Dialog will get the details from HTML file which intern include a javascript file and Cascading Style sheet. If I run the HTML in Internet Explorer 6/7 then HTML content will display with proper actions which is written in javascript.
I used QTextEdit which display the content but not icons and actions which specified in javascript file.
I used QLabel which display everything , but action specified in javascript is not executing.
At last I used even QtWebKit. There also it doesn't work. The code which I used is
QFile file("run.html");
txtEdit = new QWebView(this);
txtEdit ->settings()->setAttribute(QWebSettings::JavascriptEnabled,true) ;
txtEdit ->settings()->setAttribute(QWebSettings::JavascriptCanOpenWindow s,true);
txtEdit ->settings()->setAttribute(QWebSettings::JavascriptCanAccessClip board,true);

if (file.open(QIODevice::ReadOnly|QIODevice::Text))
{
txtEdit ->setHtml(file.ReadAll());
}

txtEdit->setGeometry(20,20,500,500);
mainLayout->addWidget(txtEdit);
setMinimumSize(600,600);

I have attached 2 files. Please copy Images file inside the HTMLtextDisplay folder after extracting both. run the html file in Internet Explorer.
This look and feel i need to develop in Qt.

THRESHE
27th August 2008, 14:53
You can try to use QAssistantClient (http://doc.trolltech.com/4.4/qassistantclient.html) :cool:

aamer4yu
27th August 2008, 20:04
From the docs -

The QAssistantClient class provides a means of using Qt Assistant as an application's help tool. More...
#include <QAssistantClient>
This class is obsolete. It is provided to keep old source code working. We strongly advise against using it in new code.

So better not use it.

As for QLabel, u need to use setOpenExternalLinks(true). but still in ur case, i tried with QLabel, but QLabel doesnt seem to have any knowledge of scripts i guess. :(

As for QwebView,,,i havent used it before :(