LeechCraft  0.6.70-15082-g543737046d
Modular cross-platform feature rich live environment.
LC::Util::ToolTipItem Class Reference

ToolTip for Qml objects. More...

#include "tooltipitem.h"

+ Inheritance diagram for LC::Util::ToolTipItem:
+ Collaboration diagram for LC::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 (QQuickItem *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 (QHoverEvent *) override
 
void hoverLeaveEvent (QHoverEvent *) 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:

import org.LC.common 1.0

And now you can use tooltip:

Rectangle {
anchors.fill: parent
MouseArea {
anchors.fill: subjectText
hoverEnabled: true
ToolTip {
anchors.fill: parent
text: "tooltip text"
}
}
}

Definition at line 56 of file tooltipitem.h.

Constructor & Destructor Documentation

◆ ToolTipItem()

LC::Util::ToolTipItem::ToolTipItem ( QQuickItem *  parent = nullptr)
explicit

Constructs the tooltip with the given parent item.

Parameters
[in]parentThe parent item for this tooltip.

Definition at line 21 of file tooltipitem.cpp.

Member Function Documentation

◆ ContainsMouse()

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

Returns whether the tooltip contains the mouse.

Returns
Whether the tooltip contains the mouse pointer.

Definition at line 46 of file tooltipitem.cpp.

References text.

◆ containsMouseChanged

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

Emitted when the containsMouse property changes.

Referenced by ShowToolTip().

+ Here is the caller graph for this function:

◆ GetText()

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

Returns the text of this tooltip.

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

Definition at line 41 of file tooltipitem.cpp.

◆ hoverEnterEvent()

void LC::Util::ToolTipItem::hoverEnterEvent ( QHoverEvent *  event)
overrideprotected

Definition at line 56 of file tooltipitem.cpp.

◆ hoverLeaveEvent()

void LC::Util::ToolTipItem::hoverLeaveEvent ( QHoverEvent *  event)
overrideprotected

Definition at line 64 of file tooltipitem.cpp.

◆ SetText()

void LC::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 32 of file tooltipitem.cpp.

◆ showToolTip

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

Shows the tooltip immediately.

Definition at line 72 of file tooltipitem.cpp.

◆ ShowToolTip()

void LC::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 51 of file tooltipitem.cpp.

References containsMouseChanged().

◆ textChanged

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

Emitted when the text of this tooltip changes.

Property Documentation

◆ containsMouse

bool LC::Util::ToolTipItem::containsMouse
read

Whether this tooltip contains mouse.

Definition at line 72 of file tooltipitem.h.

◆ text

QString LC::Util::ToolTipItem::text
readwrite

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

Definition at line 68 of file tooltipitem.h.

Referenced by ContainsMouse().


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