Overte C++ Documentation
Tooltip.h
1 //
2 // Tooltip.h
3 // libraries/ui/src
4 //
5 // Created by Bradley Austin Davis on 2015/04/14
6 // Copyright 2015 High Fidelity, Inc.
7 //
8 // Distributed under the Apache License, Version 2.0.
9 // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
10 //
11 
12 #pragma once
13 #ifndef hifi_Tooltip_h
14 #define hifi_Tooltip_h
15 
16 #include <QtNetwork/QNetworkReply>
17 
18 #include "OffscreenQmlDialog.h"
19 
20 class Tooltip : public QQuickItem
21 {
22  Q_OBJECT
23  HIFI_QML_DECL
24 
25 private:
26  Q_PROPERTY(QString title READ getTitle WRITE setTitle NOTIFY titleChanged)
27  Q_PROPERTY(QString description READ getDescription WRITE setDescription NOTIFY descriptionChanged)
28  Q_PROPERTY(QString imageURL READ getImageURL WRITE setImageURL NOTIFY imageURLChanged)
29 
30 public:
31  Tooltip(QQuickItem* parent = 0);
32  virtual ~Tooltip();
33 
34  const QString& getTitle() const { return _title; }
35  const QString& getDescription() const { return _description; }
36  const QString& getImageURL() const { return _imageURL; }
37 
38  static QString showTip(const QString& title, const QString& description);
39  static void closeTip(const QString& tipId);
40 
41 public slots:
42  void setTitle(const QString& title);
43  void setDescription(const QString& description);
44  void setImageURL(const QString& imageURL);
45 
46 signals:
47  void titleChanged();
48  void descriptionChanged();
49  void imageURLChanged();
50 
51 private slots:
52  void handleAPIResponse(QNetworkReply* requestReply);
53 
54 private:
55  void requestHyperlinkImage();
56 
57  QString _title;
58  QString _description;
59  QString _imageURL { "../images/no-picture-provided.svg" };
60 };
61 
62 #endif // hifi_Tooltip_h