diff options
Diffstat (limited to 'src/assistant/help')
-rw-r--r-- | src/assistant/help/doc/src/qthelp.qdoc | 46 | ||||
-rw-r--r-- | src/assistant/help/qhelpsearchresultwidget.cpp | 21 |
2 files changed, 23 insertions, 44 deletions
diff --git a/src/assistant/help/doc/src/qthelp.qdoc b/src/assistant/help/doc/src/qthelp.qdoc index 9b02c9612..0734d62a8 100644 --- a/src/assistant/help/doc/src/qthelp.qdoc +++ b/src/assistant/help/doc/src/qthelp.qdoc @@ -128,7 +128,7 @@ \li .qhc \li The help collection file that QHelpEngine operates on. It can contain references to any number of compressed help files as - well as additional information, such as custom filters. + well as additional information. \endtable \section1 Generating Qt Help @@ -275,48 +275,14 @@ The virtual folder tag is mandatory and the folder name must not contain any slashes (/). - \target Custom Filters - \section2 Custom Filters - - The Qt help project file contains optional definitions of - custom filters. A custom filter contains a list of filter - attributes which will be used later to display only the documentation - set that has all those attributes assigned. So, when setting the - current filter in the QHelpEngine to \e {My Application 1.0} only - the documentation which has \e myapp and \e {1.0} set as filter - attributes will be shown. - - \snippet doc_src_qthelp.qdoc 9 - - You can define any number of custom filters in a help project file. - It is important to know that you do not have to specify the filter - attributes in the same project file. These attributes can be defined - in any help file, in a filter section. - \target Filter Section \section2 Filter Section - A filter section contains the actual documentation. One Qt help project - file may contain more than one filter sections. Every filter section - consists of four parts, the filter attributes section, the table of - contents, the keywords and the files list. In theory all parts are - optional but not specifying anything there will result in an empty - documentation set. - - \section3 Filter Attributes - - Every filter section should have filter attributes assigned to it, to - enable documentation filtering. If no filter attribute is defined, the - documentation will only be shown if no filtering occurs, meaning the - current custom filter in the QHelpEngine does not contain any filter - attributes. - - \snippet doc_src_qthelp.qdoc 10 - - In this case, the filter attributes \e myapp and \e {1.0} are assigned to - the filter section. This means that all contents specified in this section - will only be shown if the current custom filter has \e myapp or \e {1.0}, - or both, as filter attributes. + A filter section contains the actual documentation. A Qt help project + file may contain more than one filter section. Every filter section + consists of the table of contents, the keywords, and the files list. + In theory all parts are optional but not specifying anything there will + result in an empty documentation set. \section3 Table of Contents diff --git a/src/assistant/help/qhelpsearchresultwidget.cpp b/src/assistant/help/qhelpsearchresultwidget.cpp index b7d61b494..ff3408f3f 100644 --- a/src/assistant/help/qhelpsearchresultwidget.cpp +++ b/src/assistant/help/qhelpsearchresultwidget.cpp @@ -60,6 +60,7 @@ QT_BEGIN_NAMESPACE class QResultWidget : public QTextBrowser { Q_OBJECT + Q_PROPERTY(QColor linkColor READ linkColor WRITE setLinkColor) public: QResultWidget(QWidget *parent = nullptr) @@ -68,6 +69,15 @@ public: connect(this, &QTextBrowser::anchorClicked, this, &QResultWidget::requestShowLink); setContextMenuPolicy(Qt::NoContextMenu); + setLinkColor(palette().color(QPalette::Link)); + } + + QColor linkColor() const { return m_linkColor; } + void setLinkColor(const QColor &color) + { + m_linkColor = color; + const QString sheet = QString::fromLatin1("a { text-decoration: underline; color: %1 }").arg(m_linkColor.name()); + document()->setDefaultStyleSheet(sheet); } void showResultPage(const QVector<QHelpSearchResult> results, bool isIndexing) @@ -88,10 +98,10 @@ public: } for (const QHelpSearchResult &result : results) { - str << "<div style=\"text-align:left; font-weight:bold\"><a href=\"" - << result.url().toString() << "\">" << result.title() << "</a>" - "<div style=\"color:green; font-weight:normal;" - " margin:5px\">" << result.snippet() << "</div></div><p></p>"; + str << "<div style=\"text-align:left\"><a href=\"" + << result.url().toString() << "\">" + << result.title() << "</a></div>" + "<div style =\"margin:5px\">" << result.snippet() << "</div>"; } } else { str << "<div align=\"center\"><br><br><h2>" @@ -114,6 +124,9 @@ signals: private slots: void setSource(const QUrl & /* name */) override {} + +private: + QColor m_linkColor; }; |