7 #include "HelpBrowser.h" 8 #include "HelpWindow.h" 10 #include <QApplication> 12 #include <QHelpContentWidget> 13 #include <QHelpEngine> 14 #include <QHelpIndexWidget> 18 const int MIN_WIDTH = 600;
19 const int MIN_HEIGHT = 600;
24 setMinimumWidth (MIN_WIDTH);
25 setMinimumHeight (MIN_HEIGHT);
27 QHelpEngine *helpEngine =
new QHelpEngine (helpPath());
28 helpEngine->setupData();
30 QTabWidget *tabs =
new QTabWidget;
31 tabs->addTab (helpEngine->contentWidget(),
33 tabs->addTab (helpEngine->indexWidget(),
37 browser->setSource (QUrl (
"qthelp://engaugedigitizer.net/doc/index.html"));
38 connect (helpEngine->contentWidget (), SIGNAL (linkActivated (QUrl)), browser, SLOT (setSource (QUrl)));
39 connect (helpEngine->indexWidget (), SIGNAL (linkActivated (QUrl, QString)), browser, SLOT (setSource (QUrl)));
41 QSplitter *splitter =
new QSplitter (Qt::Horizontal);
42 splitter->insertWidget (0, tabs);
43 splitter->insertWidget (1, browser);
48 QString HelpWindow::helpPath()
const 54 #define QUOTE(string) _QUOTE(string) 55 #define _QUOTE(string) #string 56 QString path = QString (
"%1/engauge.qhc")
57 .arg (QUOTE (HELPDIR));
60 paths <<
"/documentation/engauge.qhc";
61 paths <<
"/../share/doc/engauge-digitizer/engauge.qhc";
63 QStringList::iterator itr;
64 for (itr = paths.begin(); itr != paths.end(); itr++) {
66 QString pathAsIs = *itr;
68 QFile fileAsIs (pathAsIs);
69 if (fileAsIs.exists()) {
73 QString pathWithPrefix = QApplication::applicationDirPath() + pathAsIs;
75 QFile fileWithPrefix (pathWithPrefix);
76 if (fileWithPrefix.exists()) {
77 return pathWithPrefix;
HelpWindow(QWidget *parent)
Single constructor.
Text browser with resource loading enhanced for use as help text browser.