aboutsummaryrefslogtreecommitdiffstats
path: root/examples/quick/demos/tweetsearch/doc/src/tweetsearch.qdoc
blob: 4145ccfc148640f65855d4082e13fcf70e3ec148 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
/****************************************************************************
**
** Copyright (C) 2017 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:FDL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Free Documentation License Usage
** Alternatively, this file may be used under the terms of the GNU Free
** Documentation License version 1.3 as published by the Free Software
** Foundation and appearing in the file included in the packaging of
** this file. Please review the following information to ensure
** the GNU Free Documentation License version 1.3 requirements
** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
** $QT_END_LICENSE$
**
****************************************************************************/

/*!
    \title Qt Quick Demo - Tweet Search
    \ingroup qtquickdemos
    \example demos/tweetsearch
    \brief A Twitter search client with 3D effects.
    \image qtquick-demo-tweetsearch-med-1.png
    \image qtquick-demo-tweetsearch-med-2.png

    \e{Tweet Search} is a QML application that searches items posted to Twitter
    service using a number of query parameters. Search can be done for tweets
    from a specified user, a hashtag, or a search phrase.

    The search result is a list of items showing the contents of the
    tweet as well as the name and image of the user who posted it.
    Hashtags, names and links in the content are clickable. Clicking
    on the image will flip the item to reveal more information.

    \include examples-run.qdocinc

    Tweet Search uses Twitter API v1.1 for running seaches.

    \section1 Request Authentication

    Each request must be authenticated on behalf of the application.
    For demonstration purposes, the application uses a hard-coded
    token for identifying itself to the Twitter service. However, this
    token is subject to rate limits for the number of requests as well
    as possible expiration.

    If you are having authentication or rate limit problems running the
    demo, obtain a set of application-specific tokens (consumer
    key and consumer secret) by registering a new application on
    \l{https://dev.twitter.com/apps}.

    Type in the two token values in \e {TweetsModel.qml}:

    \snippet demos/tweetsearch/content/TweetsModel.qml auth tokens

    Rebuild and run the demo.

    \section1 JSON Parsing

    Search results are returned in JSON (JavaScript Object Notation)
    format. \c TweetsModel uses an \l XMLHTTPRequest object to send
    an HTTP GET request, and calls JSON.parse() on the returned text
    string to convert it to a JavaScript object. Each object
    representing a tweet is then added to a \l ListModel:

    \snippet demos/tweetsearch/content/TweetsModel.qml requesting

    \sa {QML Applications}
*/