MuseScore  3.4
Music composition and notation
nativetooltip.h
Go to the documentation of this file.
1 //=============================================================================
2 // MuseScore
3 // Music Composition & Notation
4 //
5 // Copyright (C) 2019 MuseScore BVBA
6 //
7 // This program is free software; you can redistribute it and/or modify
8 // it under the terms of the GNU General Public License version 2.
9 //
10 // This program is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 // GNU General Public License for more details.
14 //
15 // You should have received a copy of the GNU General Public License
16 // along with this program; if not, write to the Free Software
17 // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18 //=============================================================================
19 
20 #ifndef __QML_NATIVETOOLTIP_H__
21 #define __QML_NATIVETOOLTIP_H__
22 
23 namespace Ms {
24 
25 //---------------------------------------------------------
26 // QmlNativeToolTip
27 //---------------------------------------------------------
28 
29 class QmlNativeToolTip : public QObject {
30  Q_OBJECT
31 
32  Q_PROPERTY(QQuickItem* item READ item WRITE setItem)
33  Q_PROPERTY(QString text READ text WRITE setText)
34 
35  QWidget* _widget;
36  QPointer<QQuickItem> _item = nullptr;
37  QString _text;
38  QString _lastShownText;
39  QTimer _timer;
40 
41  private slots:
42  void showToolTip();
43 
44  public:
45  QmlNativeToolTip(QWidget* w, QObject* parent = nullptr);
46 
47  QQuickItem* item() const { return _item; }
48  void setItem(QQuickItem*);
49 
50  const QString& text() const { return _text; }
51  void setText(const QString& t) { _text = t; }
52  };
53 
54 } // namespace Ms
55 #endif
QPointer< QQuickItem > _item
Definition: nativetooltip.h:36
void showToolTip()
Definition: nativetooltip.cpp:52
void setText(const QString &t)
Definition: nativetooltip.h:51
Definition: nativetooltip.h:29
QString _text
Definition: nativetooltip.h:37
QTimer _timer
Definition: nativetooltip.h:39
QQuickItem * item() const
Definition: nativetooltip.h:47
QWidget * _widget
Definition: nativetooltip.h:35
Definition: aeolus.cpp:26
const QString & text() const
Definition: nativetooltip.h:50
void setItem(QQuickItem *)
Definition: nativetooltip.cpp:39
QString _lastShownText
Definition: nativetooltip.h:38