summaryrefslogtreecommitdiffstats
path: root/examples/help/contextsensitivehelp
diff options
context:
space:
mode:
Diffstat (limited to 'examples/help/contextsensitivehelp')
-rw-r--r--examples/help/contextsensitivehelp/contextsensitivehelp.pro20
-rw-r--r--examples/help/contextsensitivehelp/doc/amount.html11
-rw-r--r--examples/help/contextsensitivehelp/doc/filter.html12
-rw-r--r--examples/help/contextsensitivehelp/doc/plants.html44
-rw-r--r--examples/help/contextsensitivehelp/doc/rain.html11
-rw-r--r--examples/help/contextsensitivehelp/doc/source.html33
-rw-r--r--examples/help/contextsensitivehelp/doc/temperature.html13
-rw-r--r--examples/help/contextsensitivehelp/doc/time.html11
-rw-r--r--examples/help/contextsensitivehelp/doc/wateringmachine.qchbin0 -> 25600 bytes
-rw-r--r--examples/help/contextsensitivehelp/doc/wateringmachine.qhcbin0 -> 8192 bytes
-rw-r--r--examples/help/contextsensitivehelp/doc/wateringmachine.qhcp14
-rw-r--r--examples/help/contextsensitivehelp/doc/wateringmachine.qhp25
-rw-r--r--examples/help/contextsensitivehelp/helpbrowser.cpp80
-rw-r--r--examples/help/contextsensitivehelp/helpbrowser.h64
-rw-r--r--examples/help/contextsensitivehelp/main.cpp50
-rw-r--r--examples/help/contextsensitivehelp/wateringconfigdialog.cpp68
-rw-r--r--examples/help/contextsensitivehelp/wateringconfigdialog.h61
-rw-r--r--examples/help/contextsensitivehelp/wateringconfigdialog.ui446
18 files changed, 963 insertions, 0 deletions
diff --git a/examples/help/contextsensitivehelp/contextsensitivehelp.pro b/examples/help/contextsensitivehelp/contextsensitivehelp.pro
new file mode 100644
index 000000000..ef85c840d
--- /dev/null
+++ b/examples/help/contextsensitivehelp/contextsensitivehelp.pro
@@ -0,0 +1,20 @@
+TEMPLATE = app
+
+CONFIG += help
+
+SOURCES += main.cpp \
+ wateringconfigdialog.cpp \
+ helpbrowser.cpp
+
+HEADERS += wateringconfigdialog.h \
+ helpbrowser.h
+
+FORMS += wateringconfigdialog.ui
+
+# install
+target.path = $$[QT_INSTALL_EXAMPLES]/qttools/help/contextsensitivehelp
+sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS *.pro *.png *.doc doc
+sources.path = $$[QT_INSTALL_EXAMPLES]/qttools/help/contextsensitivehelp
+INSTALLS += target sources
+
+symbian: include($$QT_SOURCE_TREE/examples/symbianpkgrules.pri)
diff --git a/examples/help/contextsensitivehelp/doc/amount.html b/examples/help/contextsensitivehelp/doc/amount.html
new file mode 100644
index 000000000..7a02a6fd5
--- /dev/null
+++ b/examples/help/contextsensitivehelp/doc/amount.html
@@ -0,0 +1,11 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html>
+ <head>
+ <title>Water amount</title>
+ </head>
+ <body>
+ Depending on the plant, temperature and rain fall the amount needs to be larger
+ or smaller. On a really hot day without rain, the suggested <a href="plants.html">amount</a>
+ can be increased by about 10%.
+ </body>
+</html>
diff --git a/examples/help/contextsensitivehelp/doc/filter.html b/examples/help/contextsensitivehelp/doc/filter.html
new file mode 100644
index 000000000..64861126d
--- /dev/null
+++ b/examples/help/contextsensitivehelp/doc/filter.html
@@ -0,0 +1,12 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html>
+<head>
+<title>Filter</title>
+</head>
+<body>
+Depending on the source of water, it needs to be filtered or not. Filtering
+is strongly recommened for the river and lake.
+
+
+</body>
+</html>
diff --git a/examples/help/contextsensitivehelp/doc/plants.html b/examples/help/contextsensitivehelp/doc/plants.html
new file mode 100644
index 000000000..2d2bb6788
--- /dev/null
+++ b/examples/help/contextsensitivehelp/doc/plants.html
@@ -0,0 +1,44 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html>
+ <head>
+ <title>Plants</title>
+ </head>
+ <body>
+ Different kind of plants need different amounts of water. Here's a short
+ overview over the most common grown plants and their avarage need of water:
+ <br>
+ <table border=1>
+ <tr>
+ <td>Kind</td>
+ <td>Amount</td>
+ </tr>
+ <tr>
+ <td>Squash</td>
+ <td>2000</td>
+ </tr>
+ <tr>
+ <td>Bean</td>
+ <td>1500</td>
+ </tr>
+ <tr>
+ <td>Carrot</td>
+ <td>1200</td>
+ </tr>
+ <tr>
+ <td>Strawberry</td>
+ <td>1300</td>
+ </tr>
+ <tr>
+ <td>Raspberry</td>
+ <td>1000</td>
+ </tr>
+ <tr>
+ <td>Blueberry</td>
+ <td>1100</td>
+ </tr>
+ </table>
+ <br><br>
+ <font color="#ff0000">Warning:</font> Watering them too much or too little will
+ cause irreversible damage!
+ </body>
+</html>
diff --git a/examples/help/contextsensitivehelp/doc/rain.html b/examples/help/contextsensitivehelp/doc/rain.html
new file mode 100644
index 000000000..1ffe45240
--- /dev/null
+++ b/examples/help/contextsensitivehelp/doc/rain.html
@@ -0,0 +1,11 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html>
+ <head>
+ <title>Rain</title>
+ </head>
+ <body>
+ Depending on the rain fall, the automated watering system should not be
+ switched on at all. Also, the <a href="./temperature.html">temperature</a> should be
+ considered.
+ </body>
+</html>
diff --git a/examples/help/contextsensitivehelp/doc/source.html b/examples/help/contextsensitivehelp/doc/source.html
new file mode 100644
index 000000000..68b2f8c71
--- /dev/null
+++ b/examples/help/contextsensitivehelp/doc/source.html
@@ -0,0 +1,33 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html>
+ <head>
+ <title>Water Source</title>
+ </head>
+ <body>
+ The current pipe system connects to four different sources. Be aware
+ that only a limited amount of water can be taken from some sources.
+ <br>
+ <table border=1>
+ <tr>
+ <td>Source</td>
+ <td>Amount</td>
+ </tr>
+ <tr>
+ <td>Fountain</td>
+ <td>4000</td>
+ </tr>
+ <tr>
+ <td>River</td>
+ <td>6000</td>
+ </tr>
+ <tr>
+ <td>Lake</td>
+ <td>10000</td>
+ </tr>
+ <tr>
+ <td>Public Water System</td>
+ <td>unlimited</td>
+ </tr>
+ </table>
+ </body>
+</html>
diff --git a/examples/help/contextsensitivehelp/doc/temperature.html b/examples/help/contextsensitivehelp/doc/temperature.html
new file mode 100644
index 000000000..4145ed725
--- /dev/null
+++ b/examples/help/contextsensitivehelp/doc/temperature.html
@@ -0,0 +1,13 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html>
+ <head>
+ <title>Temperature</title>
+ </head>
+ <body>
+ Depending on the temperature, the plants need more or less water. The higher
+ the temperature the higher the need for water. If the temperature does not
+ reach a certain level, maybe no automatic watering should be done at all.<br>
+ Before setting this parameter for good, you should also take the amount of <a href="./rain.html">
+ rain</a> into account.
+ </body>
+</html>
diff --git a/examples/help/contextsensitivehelp/doc/time.html b/examples/help/contextsensitivehelp/doc/time.html
new file mode 100644
index 000000000..0cc81f4d0
--- /dev/null
+++ b/examples/help/contextsensitivehelp/doc/time.html
@@ -0,0 +1,11 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html>
+<head>
+<title>Starting time</title>
+</head>
+<body>
+Starting the watering too early may be ineffective since most water
+will evaporate.
+
+</body>
+</html>
diff --git a/examples/help/contextsensitivehelp/doc/wateringmachine.qch b/examples/help/contextsensitivehelp/doc/wateringmachine.qch
new file mode 100644
index 000000000..35d29be22
--- /dev/null
+++ b/examples/help/contextsensitivehelp/doc/wateringmachine.qch
Binary files differ
diff --git a/examples/help/contextsensitivehelp/doc/wateringmachine.qhc b/examples/help/contextsensitivehelp/doc/wateringmachine.qhc
new file mode 100644
index 000000000..b5653c3ff
--- /dev/null
+++ b/examples/help/contextsensitivehelp/doc/wateringmachine.qhc
Binary files differ
diff --git a/examples/help/contextsensitivehelp/doc/wateringmachine.qhcp b/examples/help/contextsensitivehelp/doc/wateringmachine.qhcp
new file mode 100644
index 000000000..eebf6520e
--- /dev/null
+++ b/examples/help/contextsensitivehelp/doc/wateringmachine.qhcp
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<QHelpCollectionProject version="1.0">
+ <docFiles>
+ <generate>
+ <file>
+ <input>wateringmachine.qhp</input>
+ <output>wateringmachine.qch</output>
+ </file>
+ </generate>
+ <register>
+ <file>wateringmachine.qch</file>
+ </register>
+ </docFiles>
+</QHelpCollectionProject> \ No newline at end of file
diff --git a/examples/help/contextsensitivehelp/doc/wateringmachine.qhp b/examples/help/contextsensitivehelp/doc/wateringmachine.qhp
new file mode 100644
index 000000000..6dd08e7ae
--- /dev/null
+++ b/examples/help/contextsensitivehelp/doc/wateringmachine.qhp
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<QtHelpProject version="1.0">
+ <virtualFolder>wateringmachine</virtualFolder>
+ <namespace>wateringcompany.com.1-0-0.premium</namespace>
+ <filterSection>
+ <keywords>
+ <keyword name="plants" id="plants" ref="plants.html"/>
+ <keyword name="temperature" id="temperature" ref="temperature.html"/>
+ <keyword name="rain" id="rain" ref="rain.html"/>
+ <keyword name="time" id="time" ref="time.html"/>
+ <keyword name="amount" id="amount" ref="amount.html"/>
+ <keyword name="source" id="source" ref="source.html"/>
+ <keyword name="filtering" id="filtering" ref="filter.html"/>
+ </keywords>
+ <files>
+ <file>plants.html</file>
+ <file>temperature.html</file>
+ <file>rain.html</file>
+ <file>time.html</file>
+ <file>amount.html</file>
+ <file>source.html</file>
+ <file>filter.html</file>
+ </files>
+ </filterSection>
+</QtHelpProject>
diff --git a/examples/help/contextsensitivehelp/helpbrowser.cpp b/examples/help/contextsensitivehelp/helpbrowser.cpp
new file mode 100644
index 000000000..d37a72f3b
--- /dev/null
+++ b/examples/help/contextsensitivehelp/helpbrowser.cpp
@@ -0,0 +1,80 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtCore/QLibraryInfo>
+#include <QtGui/QApplication>
+#include <QtHelp/QHelpEngineCore>
+
+#include "helpbrowser.h"
+
+HelpBrowser::HelpBrowser(QWidget *parent)
+ : QTextBrowser(parent)
+{
+ QString collectionFile = QLibraryInfo::location(QLibraryInfo::ExamplesPath)
+ + QLatin1String("/help/contextsensitivehelp/doc/wateringmachine.qhc");
+
+ m_helpEngine = new QHelpEngineCore(collectionFile, this);
+ if (!m_helpEngine->setupData()) {
+ delete m_helpEngine;
+ m_helpEngine = 0;
+ }
+}
+
+void HelpBrowser::showHelpForKeyword(const QString &id)
+{
+ if (m_helpEngine) {
+ QMap<QString, QUrl> links = m_helpEngine->linksForIdentifier(id);
+ if (links.count())
+ setSource(links.constBegin().value());
+ }
+}
+
+QVariant HelpBrowser::loadResource(int type, const QUrl &name)
+{
+ QByteArray ba;
+ if (type < 4 && m_helpEngine) {
+ QUrl url(name);
+ if (name.isRelative())
+ url = source().resolved(url);
+ ba = m_helpEngine->fileData(url);
+ }
+ return ba;
+}
+
diff --git a/examples/help/contextsensitivehelp/helpbrowser.h b/examples/help/contextsensitivehelp/helpbrowser.h
new file mode 100644
index 000000000..684ed6827
--- /dev/null
+++ b/examples/help/contextsensitivehelp/helpbrowser.h
@@ -0,0 +1,64 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef HELPBROWSER_H
+#define HELPBROWSER_H
+
+#include <QtGui/QTextBrowser>
+
+QT_BEGIN_NAMESPACE
+class QHelpEngineCore;
+QT_END_NAMESPACE;
+
+class HelpBrowser : public QTextBrowser
+{
+ Q_OBJECT
+
+public:
+ HelpBrowser(QWidget *parent);
+ void showHelpForKeyword(const QString &id);
+
+private:
+ QVariant loadResource(int type, const QUrl &name);
+
+ QHelpEngineCore *m_helpEngine;
+};
+
+#endif
diff --git a/examples/help/contextsensitivehelp/main.cpp b/examples/help/contextsensitivehelp/main.cpp
new file mode 100644
index 000000000..ca15d9fb6
--- /dev/null
+++ b/examples/help/contextsensitivehelp/main.cpp
@@ -0,0 +1,50 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtGui/QApplication>
+
+#include "wateringconfigdialog.h"
+
+int main(int argc, char *argv[])
+{
+ QApplication a(argc, argv);
+ WateringConfigDialog dia;
+ return dia.exec();
+}
diff --git a/examples/help/contextsensitivehelp/wateringconfigdialog.cpp b/examples/help/contextsensitivehelp/wateringconfigdialog.cpp
new file mode 100644
index 000000000..0529bfcfc
--- /dev/null
+++ b/examples/help/contextsensitivehelp/wateringconfigdialog.cpp
@@ -0,0 +1,68 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "wateringconfigdialog.h"
+
+WateringConfigDialog::WateringConfigDialog()
+{
+ m_ui.setupUi(this);
+ m_widgetInfo.insert(m_ui.plantComboBox, tr("plants"));
+ m_widgetInfo.insert(m_ui.temperatureCheckBox, tr("temperature"));
+ m_widgetInfo.insert(m_ui.temperatureSpinBox, tr("temperature"));
+ m_widgetInfo.insert(m_ui.rainCheckBox, tr("rain"));
+ m_widgetInfo.insert(m_ui.rainSpinBox, tr("rain"));
+ m_widgetInfo.insert(m_ui.startTimeEdit, tr("starting time"));
+ m_widgetInfo.insert(m_ui.amountSpinBox, tr("water amount"));
+ m_widgetInfo.insert(m_ui.sourceComboBox, tr("water source"));
+ m_widgetInfo.insert(m_ui.filterCheckBox, tr("water filtering"));
+
+ connect(qApp, SIGNAL(focusChanged(QWidget*,QWidget*)),
+ this, SLOT(focusChanged(QWidget*,QWidget*)));
+}
+
+void WateringConfigDialog::focusChanged(QWidget *, QWidget *now)
+{
+ if (m_widgetInfo.contains(now)) {
+ m_ui.helpLabel->setText(tr("Information about %1:").arg(m_widgetInfo.value(now)));
+ QStringList lst = m_widgetInfo.value(now).split(QLatin1Char(' '));
+ m_ui.helpBrowser->showHelpForKeyword(lst.last());
+ }
+}
+
diff --git a/examples/help/contextsensitivehelp/wateringconfigdialog.h b/examples/help/contextsensitivehelp/wateringconfigdialog.h
new file mode 100644
index 000000000..d1fd98643
--- /dev/null
+++ b/examples/help/contextsensitivehelp/wateringconfigdialog.h
@@ -0,0 +1,61 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef WATERINGCONFIGDIALOG_H
+#define WATERINGCONFIGDIALOG_H
+
+#include <QtGui/QDialog>
+#include "ui_wateringconfigdialog.h"
+
+class WateringConfigDialog : public QDialog
+{
+ Q_OBJECT
+public:
+ WateringConfigDialog();
+
+private slots:
+ void focusChanged(QWidget *old, QWidget *now);
+
+private:
+ Ui::WateringConfigDialog m_ui;
+ QMap<QWidget*, QString> m_widgetInfo;
+};
+
+#endif
diff --git a/examples/help/contextsensitivehelp/wateringconfigdialog.ui b/examples/help/contextsensitivehelp/wateringconfigdialog.ui
new file mode 100644
index 000000000..d7a473a3c
--- /dev/null
+++ b/examples/help/contextsensitivehelp/wateringconfigdialog.ui
@@ -0,0 +1,446 @@
+<ui version="4.0" >
+ <class>WateringConfigDialog</class>
+ <widget class="QDialog" name="WateringConfigDialog" >
+ <property name="geometry" >
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>334</width>
+ <height>550</height>
+ </rect>
+ </property>
+ <property name="windowTitle" >
+ <string>Watering Configuration</string>
+ </property>
+ <layout class="QVBoxLayout" >
+ <item>
+ <layout class="QGridLayout" >
+ <item row="0" column="0" >
+ <widget class="QLabel" name="label_3" >
+ <property name="text" >
+ <string>Plant:</string>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="1" colspan="3" >
+ <widget class="QComboBox" name="plantComboBox" >
+ <property name="sizePolicy" >
+ <sizepolicy vsizetype="Fixed" hsizetype="Preferred" >
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <item>
+ <property name="text" >
+ <string>Squash</string>
+ </property>
+ </item>
+ <item>
+ <property name="text" >
+ <string>Bean</string>
+ </property>
+ </item>
+ <item>
+ <property name="text" >
+ <string>Carrot</string>
+ </property>
+ </item>
+ <item>
+ <property name="text" >
+ <string>Strawberry</string>
+ </property>
+ </item>
+ <item>
+ <property name="text" >
+ <string>Raspberry</string>
+ </property>
+ </item>
+ <item>
+ <property name="text" >
+ <string>Blueberry</string>
+ </property>
+ </item>
+ </widget>
+ </item>
+ <item row="1" column="0" >
+ <spacer>
+ <property name="orientation" >
+ <enum>Qt::Vertical</enum>
+ </property>
+ <property name="sizeType" >
+ <enum>QSizePolicy::Fixed</enum>
+ </property>
+ <property name="sizeHint" >
+ <size>
+ <width>67</width>
+ <height>16</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item row="2" column="0" >
+ <widget class="QLabel" name="label_2" >
+ <property name="text" >
+ <string>Water when:</string>
+ </property>
+ </widget>
+ </item>
+ <item row="3" column="1" colspan="3" >
+ <widget class="QCheckBox" name="temperatureCheckBox" >
+ <property name="text" >
+ <string>Temperature is higher than:</string>
+ </property>
+ </widget>
+ </item>
+ <item row="4" column="1" >
+ <spacer>
+ <property name="orientation" >
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeType" >
+ <enum>QSizePolicy::Fixed</enum>
+ </property>
+ <property name="sizeHint" >
+ <size>
+ <width>16</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item row="4" column="2" >
+ <widget class="QSpinBox" name="temperatureSpinBox" >
+ <property name="enabled" >
+ <bool>false</bool>
+ </property>
+ <property name="specialValueText" >
+ <string/>
+ </property>
+ <property name="suffix" >
+ <string>C</string>
+ </property>
+ <property name="minimum" >
+ <number>10</number>
+ </property>
+ <property name="maximum" >
+ <number>60</number>
+ </property>
+ <property name="value" >
+ <number>20</number>
+ </property>
+ </widget>
+ </item>
+ <item row="4" column="3" >
+ <spacer>
+ <property name="orientation" >
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" >
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item row="5" column="1" colspan="3" >
+ <widget class="QCheckBox" name="rainCheckBox" >
+ <property name="text" >
+ <string>Rain less than:</string>
+ </property>
+ </widget>
+ </item>
+ <item row="6" column="1" >
+ <spacer>
+ <property name="orientation" >
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeType" >
+ <enum>QSizePolicy::Fixed</enum>
+ </property>
+ <property name="sizeHint" >
+ <size>
+ <width>16</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item row="6" column="2" >
+ <widget class="QSpinBox" name="rainSpinBox" >
+ <property name="enabled" >
+ <bool>false</bool>
+ </property>
+ <property name="specialValueText" >
+ <string/>
+ </property>
+ <property name="suffix" >
+ <string>mm</string>
+ </property>
+ <property name="minimum" >
+ <number>1</number>
+ </property>
+ </widget>
+ </item>
+ <item row="6" column="3" >
+ <spacer>
+ <property name="orientation" >
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" >
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item row="7" column="2" >
+ <spacer>
+ <property name="orientation" >
+ <enum>Qt::Vertical</enum>
+ </property>
+ <property name="sizeType" >
+ <enum>QSizePolicy::Fixed</enum>
+ </property>
+ <property name="sizeHint" >
+ <size>
+ <width>20</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item row="8" column="0" >
+ <widget class="QLabel" name="label" >
+ <property name="text" >
+ <string>Starting Time:</string>
+ </property>
+ </widget>
+ </item>
+ <item row="8" column="1" colspan="3" >
+ <widget class="QTimeEdit" name="startTimeEdit" />
+ </item>
+ <item row="9" column="0" >
+ <widget class="QLabel" name="label_4" >
+ <property name="text" >
+ <string>Amount:</string>
+ </property>
+ </widget>
+ </item>
+ <item row="9" column="1" colspan="3" >
+ <widget class="QSpinBox" name="amountSpinBox" >
+ <property name="suffix" >
+ <string>l</string>
+ </property>
+ <property name="minimum" >
+ <number>100</number>
+ </property>
+ <property name="maximum" >
+ <number>10000</number>
+ </property>
+ <property name="singleStep" >
+ <number>100</number>
+ </property>
+ <property name="value" >
+ <number>1000</number>
+ </property>
+ </widget>
+ </item>
+ <item row="10" column="0" >
+ <widget class="QLabel" name="label_5" >
+ <property name="text" >
+ <string>Source:</string>
+ </property>
+ </widget>
+ </item>
+ <item row="10" column="1" colspan="3" >
+ <widget class="QComboBox" name="sourceComboBox" >
+ <item>
+ <property name="text" >
+ <string>Fountain</string>
+ </property>
+ </item>
+ <item>
+ <property name="text" >
+ <string>River</string>
+ </property>
+ </item>
+ <item>
+ <property name="text" >
+ <string>Lake</string>
+ </property>
+ </item>
+ <item>
+ <property name="text" >
+ <string>Public Water System</string>
+ </property>
+ </item>
+ </widget>
+ </item>
+ <item row="11" column="0" >
+ <widget class="QLabel" name="label_6" >
+ <property name="text" >
+ <string>Filter:</string>
+ </property>
+ </widget>
+ </item>
+ <item row="11" column="1" colspan="2" >
+ <widget class="QCheckBox" name="filterCheckBox" >
+ <property name="text" >
+ <string/>
+ </property>
+ </widget>
+ </item>
+ <item row="12" column="0" >
+ <spacer>
+ <property name="orientation" >
+ <enum>Qt::Vertical</enum>
+ </property>
+ <property name="sizeType" >
+ <enum>QSizePolicy::Fixed</enum>
+ </property>
+ <property name="sizeHint" >
+ <size>
+ <width>20</width>
+ <height>10</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item row="4" column="4" >
+ <spacer>
+ <property name="orientation" >
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" >
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ </layout>
+ </item>
+ <item>
+ <layout class="QGridLayout" >
+ <item row="0" column="1" >
+ <spacer>
+ <property name="orientation" >
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" >
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item row="1" column="0" colspan="2" >
+ <widget class="HelpBrowser" name="helpBrowser" />
+ </item>
+ <item row="0" column="0" >
+ <widget class="QLabel" name="helpLabel" >
+ <property name="text" >
+ <string>&lt;a href="test">Show Details&lt;/a></string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ <item>
+ <widget class="Line" name="line" >
+ <property name="orientation" >
+ <enum>Qt::Horizontal</enum>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QDialogButtonBox" name="buttonBox" >
+ <property name="orientation" >
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="standardButtons" >
+ <set>QDialogButtonBox::Cancel|QDialogButtonBox::NoButton|QDialogButtonBox::Ok</set>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ <customwidgets>
+ <customwidget>
+ <class>HelpBrowser</class>
+ <extends>QTextBrowser</extends>
+ <header>helpbrowser.h</header>
+ </customwidget>
+ </customwidgets>
+ <resources/>
+ <connections>
+ <connection>
+ <sender>buttonBox</sender>
+ <signal>accepted()</signal>
+ <receiver>WateringConfigDialog</receiver>
+ <slot>accept()</slot>
+ <hints>
+ <hint type="sourcelabel" >
+ <x>227</x>
+ <y>372</y>
+ </hint>
+ <hint type="destinationlabel" >
+ <x>157</x>
+ <y>274</y>
+ </hint>
+ </hints>
+ </connection>
+ <connection>
+ <sender>buttonBox</sender>
+ <signal>rejected()</signal>
+ <receiver>WateringConfigDialog</receiver>
+ <slot>reject()</slot>
+ <hints>
+ <hint type="sourcelabel" >
+ <x>286</x>
+ <y>378</y>
+ </hint>
+ <hint type="destinationlabel" >
+ <x>286</x>
+ <y>274</y>
+ </hint>
+ </hints>
+ </connection>
+ <connection>
+ <sender>temperatureCheckBox</sender>
+ <signal>toggled(bool)</signal>
+ <receiver>temperatureSpinBox</receiver>
+ <slot>setEnabled(bool)</slot>
+ <hints>
+ <hint type="sourcelabel" >
+ <x>132</x>
+ <y>101</y>
+ </hint>
+ <hint type="destinationlabel" >
+ <x>132</x>
+ <y>125</y>
+ </hint>
+ </hints>
+ </connection>
+ <connection>
+ <sender>rainCheckBox</sender>
+ <signal>toggled(bool)</signal>
+ <receiver>rainSpinBox</receiver>
+ <slot>setEnabled(bool)</slot>
+ <hints>
+ <hint type="sourcelabel" >
+ <x>110</x>
+ <y>154</y>
+ </hint>
+ <hint type="destinationlabel" >
+ <x>113</x>
+ <y>169</y>
+ </hint>
+ </hints>
+ </connection>
+ </connections>
+</ui>