diff options
| author | Mikko Syrjä <mikko@syrja.org> | 2019-05-24 00:42:46 +0300 |
|---|---|---|
| committer | Mikko Syrjä <mikko@syrja.org> | 2019-05-24 00:42:46 +0300 |
| commit | 02fa0d4577db14fe11a8f8a7e69b1d3ecbe060a8 (patch) | |
| tree | 1c3255b8e55a33da1f0957d48760323c63c557aa | |
| parent | 0ddd579db2561e52f7b5289ec986291fb7b567dc (diff) | |
| download | symedit-02fa0d4577db14fe11a8f8a7e69b1d3ecbe060a8.tar.gz symedit-02fa0d4577db14fe11a8f8a7e69b1d3ecbe060a8.zip | |
Removed own tooltip, system tooltip seems to work now.
| -rw-r--r-- | BarTool.qml | 23 | ||||
| -rw-r--r-- | ToolTip.qml | 110 | ||||
| -rw-r--r-- | TooltipCreator.js | 29 | ||||
| -rw-r--r-- | qml.qrc | 2 |
4 files changed, 0 insertions, 164 deletions
diff --git a/BarTool.qml b/BarTool.qml index 07f4e3b..87bfd52 100644 --- a/BarTool.qml +++ b/BarTool.qml @@ -1,8 +1,6 @@ import QtQuick 2.9 import QtQuick.Controls 1.4 -import "TooltipCreator.js" as TooltipCreator - ToolButton { property string image @@ -21,27 +19,6 @@ ToolButton checkable: (tool !== 0) checked: (window.tool === tool) - onHoveredChanged: - { -/* - if ( popup !== null ) - popup.hide() - if ( hovered ) - { - popup = TooltipCreator.create(tooltip, this) - popup.show() - } -*/ - } - - onPressedChanged: - { -/* - if ( popup !== null ) - popup.hide() -*/ - } - onClicked: { if ( tool ) diff --git a/ToolTip.qml b/ToolTip.qml deleted file mode 100644 index b00e1f1..0000000 --- a/ToolTip.qml +++ /dev/null @@ -1,110 +0,0 @@ -// original code from https://wiki.qt.io/QtQuick_ToolTip_Component - -import QtQuick 2.2 - -Rectangle -{ - id: tooltip - - property alias text: tooltipText.text - property alias textItem: tooltipText - property int fadeInDelay: 200 - property int fadeOutDelay: 200 - property bool autoHide: true - property alias autoHideDelay: hideTimer.interval - property bool destroyOnHide: true - - function show() - { - showTimer.start() - } - - function hide() - { - if ( showTimer.running ) - showTimer.stop() - if ( hideTimer.running ) - hideTimer.stop() - state = "hidden" - } - - width: tooltipText.width + 20 - height: tooltipText.height + 10 - color: "#dd000000" - radius: 5 - opacity: 0 - z: 30 - - Text - { - id: tooltipText - anchors.centerIn: parent - horizontalAlignment: Text.AlignHCenter - color: "white" - font.pointSize: 10 - font.bold: true - } - - MouseArea - { - anchors.fill: parent - onClicked: hide() - } - - Timer - { - id: showTimer - interval: 1000 - onTriggered: - { - state = "showing" - if ( hideTimer.running ) - hideTimer.restart() - } - } - - Timer - { - id: hideTimer - interval: 1000 - onTriggered: hide() - } - - states: - [ - State - { - name: "showing" - PropertyChanges { target: tooltip; opacity: 1 } - onCompleted: - { - if ( autoHide ) - hideTimer.start() - } - }, - State - { - name: "hidden" - PropertyChanges { target: tooltip; opacity: 0 } - onCompleted: - { - if ( destroyOnHide ) - tooltip.destroy() - } - } - ] - - transitions: - [ - Transition - { - to: "showing" - NumberAnimation { target: tooltip; property: "opacity"; duration: fadeInDelay } - }, - Transition - { - to: "hidden" - NumberAnimation { target: tooltip; property: "opacity"; duration: fadeOutDelay } - } - ] -} diff --git a/TooltipCreator.js b/TooltipCreator.js deleted file mode 100644 index a142fde..0000000 --- a/TooltipCreator.js +++ /dev/null @@ -1,29 +0,0 @@ -// original code from https://wiki.qt.io/QtQuick_ToolTip_Component - -var component = Qt.createComponent("ToolTip.qml"); - -function create(text, parent, properties) -{ - if ( typeof properties == "undefined" ) - { - properties = - { - anchors: - { - left: parent.horizontalCenter, - top: parent.bottom, - } - }; - } - properties.text = text; - var tooltip = component.createObject(parent, properties); - if ( tooltip === null ) - console.error("error creating tooltip: " + component.errorString()); - else if ( properties.anchors ) - { - // manual anchor mapping necessary - for ( var anchor in properties.anchors ) - tooltip.anchors[anchor] = properties.anchors[anchor]; - } - return tooltip; -} @@ -15,8 +15,6 @@ <file>image/save_icon&48.png</file> <file>image/text.png</file> <file>image/delete.png</file> - <file>ToolTip.qml</file> - <file>TooltipCreator.js</file> <file>image/redo_icon&48.png</file> <file>image/undo_icon&48.png</file> <file>image/copy_icon&48.png</file> |
