LeechCraft  0.6.70-6645-gcd10d7e
Modular cross-platform feature rich live environment.
LeechCraft::Util::ToolTipItem Class Reference

ToolTip for Qml objects. More...

#include "tooltipitem.h"

+ Inheritance diagram for LeechCraft::Util::ToolTipItem:
+ Collaboration diagram for LeechCraft::Util::ToolTipItem:

Public Slots

void showToolTip ()
 Shows the tooltip immediately. More...
 

Signals

void textChanged ()
 Emitted when the text of this tooltip changes. More...
 
void containsMouseChanged ()
 Emitted when the containsMouse property changes. More...
 

Public Member Functions

 ToolTipItem (QDeclarativeItem *parent=nullptr)
 Constructs the tooltip with the given parent item. More...
 
void SetText (const QString &text)
 Sets the text contained in this tooltip to text. More...
 
QString GetText () const
 Returns the text of this tooltip. More...
 
bool ContainsMouse () const
 Returns whether the tooltip contains the mouse. More...
 
void ShowToolTip (const QString &text) const
 Shows tooltip with the given text immediately. More...
 

Protected Member Functions

void hoverEnterEvent (QGraphicsSceneHoverEvent *) override
 
void hoverLeaveEvent (QGraphicsSceneHoverEvent *) override
 

Properties

QString text
 The text of this tooltip item (rich text supported). More...
 
bool containsMouse
 Whether this tooltip contains mouse. More...
 

Detailed Description

ToolTip for Qml objects.

Rich text is supported.

Using the tooltip is pretty easy. First of all register tooltip in your widget:

qmlRegisterType<Util::ToolTipItem> ("org.LC.common", 1, 0, "ToolTip");

Then in yout qml import this widget:

1 import org.LC.common 1.0

And now you can use tooltip:

1 Rectangle {
2  anchors.fill: parent
3 
4  MouseArea {
5  anchors.fill: subjectText
6  hoverEnabled: true
7  ToolTip {
8  anchors.fill: parent
9  text: "tooltip text"
10  }
11  }
12 }

Definition at line 78 of file tooltipitem.h.

Constructor & Destructor Documentation

LeechCraft::Util::ToolTipItem::ToolTipItem ( QDeclarativeItem *  parent = nullptr)

Constructs the tooltip with the given parent item.

Parameters
[in]parentThe parent item for this tooltip.

Definition at line 39 of file tooltipitem.cpp.

References showToolTip().

+ Here is the call graph for this function:

Member Function Documentation

bool LeechCraft::Util::ToolTipItem::ContainsMouse ( ) const

Returns whether the tooltip contains the mouse.

Returns
Whether the tooltip contains the mouse pointer.

Definition at line 68 of file tooltipitem.cpp.

void LeechCraft::Util::ToolTipItem::containsMouseChanged ( )
signal

Emitted when the containsMouse property changes.

Referenced by hoverEnterEvent(), and hoverLeaveEvent().

+ Here is the caller graph for this function:

QString LeechCraft::Util::ToolTipItem::GetText ( ) const

Returns the text of this tooltip.

Returns
The text contained in this tooltip.
See also
SetText()

Definition at line 63 of file tooltipitem.cpp.

void LeechCraft::Util::ToolTipItem::hoverEnterEvent ( QGraphicsSceneHoverEvent *  event)
overrideprotected

Definition at line 79 of file tooltipitem.cpp.

References containsMouseChanged().

void LeechCraft::Util::ToolTipItem::hoverLeaveEvent ( QGraphicsSceneHoverEvent *  event)
overrideprotected

Definition at line 95 of file tooltipitem.cpp.

References containsMouseChanged().

void LeechCraft::Util::ToolTipItem::SetText ( const QString &  text)

Sets the text contained in this tooltip to text.

Parameters
[in]textThe text of this tooltip.
See also
GetText()

Definition at line 54 of file tooltipitem.cpp.

References text, and textChanged().

void LeechCraft::Util::ToolTipItem::ShowToolTip ( const QString &  text) const

Shows tooltip with the given text immediately.

The passed text overrides the text property of this tooltip, but does not change it.

Definition at line 73 of file tooltipitem.cpp.

Referenced by showToolTip().

+ Here is the caller graph for this function:

void LeechCraft::Util::ToolTipItem::showToolTip ( )
slot

Shows the tooltip immediately.

Definition at line 110 of file tooltipitem.cpp.

References ShowToolTip().

Referenced by ToolTipItem().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void LeechCraft::Util::ToolTipItem::textChanged ( )
signal

Emitted when the text of this tooltip changes.

Referenced by SetText().

+ Here is the caller graph for this function:

Property Documentation

bool LeechCraft::Util::ToolTipItem::containsMouse
read

Whether this tooltip contains mouse.

Definition at line 91 of file tooltipitem.h.

QString LeechCraft::Util::ToolTipItem::text
readwrite

The text of this tooltip item (rich text supported).

Definition at line 87 of file tooltipitem.h.

Referenced by SetText().


The documentation for this class was generated from the following files: