Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
qhelpsearchresult.cpp
Go to the documentation of this file.
1// Copyright (C) 2024 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3// Qt-Security score:significant reason:default
4
6
7#include <QtCore/qstring.h>
8#include <QtCore/qurl.h>
9
11
13{
14public:
15 QUrl m_url;
16 QString m_title;
17 QString m_snippet;
18};
19
20/*!
21 \class QHelpSearchResult
22 \since 5.9
23 \inmodule QtHelp
24 \brief The QHelpSearchResult class provides the data associated with the
25 search result.
26
27 The QHelpSearchResult object is a data object that describes a single search result.
28 The vector of search result objects is returned by QHelpSearchEngine::searchResults().
29 The description of the search result contains the document title and URL
30 that the search input matched. It also contains the snippet from
31 the document content containing the best match of the search input.
32 \sa QHelpSearchEngine
33*/
34
35/*!
36 Constructs a new empty QHelpSearchResult.
37*/
38QHelpSearchResult::QHelpSearchResult() : d(new QHelpSearchResultData) { }
39
40/*!
41 Constructs a copy of \a other.
42*/
43QHelpSearchResult::QHelpSearchResult(const QHelpSearchResult &other) = default;
44
45/*!
46 Constructs the search result containing \a url, \a title and \a snippet
47 as the description of the result.
48*/
49QHelpSearchResult::QHelpSearchResult(const QUrl &url, const QString &title, const QString &snippet)
50 : d(new QHelpSearchResultData)
51{
52 d->m_url = url;
53 d->m_title = title;
54 d->m_snippet = snippet;
55}
56
57/*!
58 Destroys the search result.
59*/
60QHelpSearchResult::~QHelpSearchResult() = default;
61
62/*!
63 Assigns \a other to this search result and returns a reference to this search result.
64*/
65QHelpSearchResult &QHelpSearchResult::operator=(const QHelpSearchResult &other) = default;
66
67/*!
68 Returns the document title of the search result.
69*/
70QString QHelpSearchResult::title() const
71{
72 return d->m_title;
73}
74
75/*!
76 Returns the document URL of the search result.
77*/
78QUrl QHelpSearchResult::url() const
79{
80 return d->m_url;
81}
82
83/*!
84 Returns the document snippet containing the search phrase of the search result.
85*/
86QString QHelpSearchResult::snippet() const
87{
88 return d->m_snippet;
89}
90
91QT_END_NAMESPACE
Combined button and popup list for selecting options.