Skip to content

Instantly share code, notes, and snippets.

@webmaster128
Last active March 29, 2021 10:34
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save webmaster128/d32a278d4037a72dd47a to your computer and use it in GitHub Desktop.
Save webmaster128/d32a278d4037a72dd47a to your computer and use it in GitHub Desktop.
TooltipArea.qml
import QtQuick 2.4
import QtQuick.Controls.Private 1.0
// TooltipArea.qml
// This file contains private Qt Quick modules that might change in future versions of Qt
// Tested on: Qt 5.4.1 - Qt 5.6.1
MouseArea {
property string text: ""
id: root
anchors.fill: parent
acceptedButtons: Qt.NoButton
hoverEnabled: root.enabled
onExited: Tooltip.hideText()
onCanceled: Tooltip.hideText()
Timer {
interval: 1000
running: root.enabled && root.containsMouse && root.text.length
onTriggered: Tooltip.showText(root, Qt.point(root.mouseX, root.mouseY), root.text)
}
}
@mittal-n
Copy link

mittal-n commented Jul 3, 2018

Can you please tell me how to change the color of a tool tip and background color of the rectangle?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment