使用 Qt Assistant

You can read documentation in the 文档编制 window. To open a topic in a new tab, right click it in the 内容 window to open a context menu and select Open Link in New Tab . All open topics are listed in the Open Pages window. Select a topic to view it in the 文档编制 窗口。

If you want the 文档编制 window to use as much space as possible, you can easily group, move or hide the sidebar windows. To group the windows, drag one on top of the other and release the mouse. If one or all sidebar windows are not shown, select keyboard shortcuts to display them. You can view the keyboard shortcuts in the View 菜单。

The sidebar windows can be docked into the main window, so you can drag them to the top, left, right or bottom of the main window, or you can drag them outside Qt Assistant to float them as independent windows.

To change the font family and font sizes of the browser window displaying the documentation or the application itself, select 编辑 > 首选项 > 字体 .

To temporarily increase or decrease the font size in the 文档编制 window, select View > Zoom in or Zoom out . To reset the font size, select View > Normal Size .

To navigate between pages, select Go > 上一 or 下一 . This takes you to the previous or next page in the history. To return to the home page, select Go > 首页 . To specify the home page, select 编辑 > 首选项 > 选项 .

To synchronize the 内容 window with the page currently shown in the 文档编制 window, select Go > Sync with Table of Contents .

The address toolbar provides a fast way to enter a specific URL for a documentation file. To show the address toolbar, select View > 工具栏 > Address Toolbar .

搜索页面内容

To find text on the current page, select 编辑 > Find in Text . Enter the search term in the field. The search is incremental, meaning that the most relevant result is shown as you enter characters into the field.

If you select the Case sensitive checkbox, the search considers the case of the search term. For example, if you search for spin , it matches spin but not Spin .

To search forwards or backwards from your current position on the page, click 上一 or 下一 .

To hide the find control, either click Close or press Esc .

FTS (全文搜索)

Qt Assistant provides a powerful full text search engine. You can search for certain words or text in the Search window. Enter the text you want to look for and press Enter or click Search . The search is not case sensitive. For example, Foo , fOo and FOO are all treated as the same.

You can create complex queries using the FTS query syntax .

The following are examples of common search patterns:

  • deep -- lists all the documents that contain the word deep
  • deep* -- lists all the documents that contain a word beginning with deep
  • 深拷贝 -- lists all documents that contain both deep and copy
  • "deep copy" -- list all documents that contain the phrase 深拷贝

The list of documents found is ordered according to the number of occurrences of the search text which they contain, with those containing the highest number of occurrences appearing first. Simply click any document in the list to display it in the 文档编制 窗口。

If the documentation has changed — for example, if documents have been added or removed — Qt Assistant will index them again.

筛选帮助内容

Qt Assistant allows you to install any kind of documentation as long as it is organized in Qt compressed help files (*.qch). For example, you can view Qt reference documentation for several Qt versions at the same time. In many respects, this is very convenient since only one version of Qt Assistant is needed. However, at the same time it becomes more complicated when performing tasks like searching the index because most keywords are defined in more than one Qt version. This means that Qt Assistant will always ask the user to choose which one should be displayed.

We use documentation filters to solve this issue. A filter is identified by its name, and contains a list of filter attributes. An attribute is just a string and can be freely chosen. Attributes are defined by the documentation itself, which means that every documentation set usually has one or more attributes.

例如, Qt Assistant documentation defines the attributes assistant and tools ,而 Qt Designer 定义 designer and tools . The filter to display all tools would then define only the attribute tools since this attribute is part of both documentation sets. Adding the attribute assistant to the filter would then only show Qt Assistant documentation since the Qt Designer documentation does not contain this attribute. Having an empty list of attributes in a filter will match all documentation. That is, it is equivalent to requesting unfiltered documentation.

To create and remove documentation filters, select 编辑 > 首选项 > 过滤器 .

To add a new filter, click 添加 , specify a filter name, and click OK . Then select the filter attributes in the 属性 字段。

To delete a filter, select it and click 移除 .

The filter toolbar allows you to apply a filter to the currently installed documentation. To show the filter toolbar, select View > 工具栏 > Filter Toolbar .

添加文档编制

要安装和移除压缩帮助文件,选择 编辑 > 首选项 > 文档编制 .

点击 安装 button and choose the path of the compressed help file (*.qch) you would like to install. To delete a help file, select a documentation set in the list and click 移除 .

指定首页

To specify the homepage Qt Assistant displays when you click the 首页 button, select 编辑 > 首选项 > 选项 .

Enter the URL of the home page or select Current Page to set the currently displayed page as your home page. To leave the home page blank, select Blank page . Select Restore to default to reset your home page to the default home page.

使用命令行选项

Qt Assistant 处理下列命令行选项:

命令行选项 简要描述
-collectionFile <file.qhc> Uses the specified collection file instead of the default one.
-showUrl <URL> Shows the document referenced by URL.
-enableRemoteControl Enables Qt Assistant to be remotely controlled.
-show <widget> Shows the specified sidebar window which can be "contents", "index", "bookmarks" or "search".
-hide <widget> Hides the specified sidebar window which can be "contents", "index", "bookmarks" or "search".
-activate <widget> Activates the specified sidebar window which can be "contents", "index", "bookmarks" or "search".
-register <doc.qch> Registers the specified compressed help file in the given help collection.
-unregister <doc.qch> Unregisters the specified compressed help file from the given collection file.
-remove-search-index Purges the help search engine's index. This option is useful in case the associated index files get corrupted. Qt Assistant will re-index the documentation at the next start-up.
-rebuild-search-index Rebuilds the help search engine's index. Note that this operation may take a while to finish.
-setCurrentFilter <filter> Sets the given filter as the active filter.
-quiet Does not show any error, warning or success messages.