diff options
author | J-P Nurmi <jpnurmi@theqtcompany.com> | 2016-03-01 13:26:21 +0100 |
---|---|---|
committer | J-P Nurmi <jpnurmi@theqtcompany.com> | 2016-03-22 19:32:37 +0000 |
commit | cd716f1b1c903b7a2fdfd82bb88959119ebca72d (patch) | |
tree | a8ff297e58d34b0c8b6fd24a51a2301c8c2708bb /examples | |
parent | faa65aebb2e52cc809248f6cbb86b994ff329285 (diff) |
Introduce ToolTip
Change-Id: I917f7e83219788fc63389773eb07ee39757bed7f
Task-number: QTBUG-51003
Reviewed-by: Mitch Curtis <mitch.curtis@theqtcompany.com>
Diffstat (limited to 'examples')
-rw-r--r-- | examples/controls/gallery/gallery.qml | 1 | ||||
-rw-r--r-- | examples/controls/gallery/gallery.qrc | 1 | ||||
-rw-r--r-- | examples/controls/gallery/pages/ToolTipPage.qml | 68 |
3 files changed, 70 insertions, 0 deletions
diff --git a/examples/controls/gallery/gallery.qml b/examples/controls/gallery/gallery.qml index aba183db..8a2c38d4 100644 --- a/examples/controls/gallery/gallery.qml +++ b/examples/controls/gallery/gallery.qml @@ -162,6 +162,7 @@ ApplicationWindow { ListElement { title: "TabBar"; source: "qrc:/pages/TabBarPage.qml" } ListElement { title: "TextArea"; source: "qrc:/pages/TextAreaPage.qml" } ListElement { title: "TextField"; source: "qrc:/pages/TextFieldPage.qml" } + ListElement { title: "ToolTip"; source: "qrc:/pages/ToolTipPage.qml" } ListElement { title: "Tumbler"; source: "qrc:/pages/TumblerPage.qml" } } diff --git a/examples/controls/gallery/gallery.qrc b/examples/controls/gallery/gallery.qrc index 1b74b434..ee4bf5b7 100644 --- a/examples/controls/gallery/gallery.qrc +++ b/examples/controls/gallery/gallery.qrc @@ -46,6 +46,7 @@ <file>pages/TabBarPage.qml</file> <file>pages/TextAreaPage.qml</file> <file>pages/TextFieldPage.qml</file> + <file>pages/ToolTipPage.qml</file> <file>pages/TumblerPage.qml</file> <file>pages/DelegatePage.qml</file> </qresource> diff --git a/examples/controls/gallery/pages/ToolTipPage.qml b/examples/controls/gallery/pages/ToolTipPage.qml new file mode 100644 index 00000000..27e2ba01 --- /dev/null +++ b/examples/controls/gallery/pages/ToolTipPage.qml @@ -0,0 +1,68 @@ +/**************************************************************************** +** +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of The Qt Company Ltd nor the names of its +** contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.6 +import Qt.labs.controls 1.0 + +Pane { + id: pane + + Column { + spacing: 40 + width: parent.width + + Label { + width: parent.width + wrapMode: Label.Wrap + horizontalAlignment: Qt.AlignHCenter + text: "A tool tip is a short piece of text that informs the user of a control's function." + } + + Button { + text: "Tip" + anchors.horizontalCenter: parent.horizontalCenter + width: Math.max(implicitWidth, Math.min(implicitWidth * 2, pane.availableWidth / 3)) + + ToolTip.timeout: 5000 + ToolTip.visible: pressed + ToolTip.text: "This is a tool tip." + } + } +} |