From efd12a5ec1e27606a08b462403b59c22d41c8052 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20K=C3=BCgler?= Date: Thu, 4 Apr 2013 01:26:59 +0200 Subject: [PATCH] Add components to default tooltip, fix layout --- src/declarativeimports/core/ToolTip.qml | 55 +++++++++++++++++++++---- src/declarativeimports/core/tooltip.cpp | 2 +- 2 files changed, 49 insertions(+), 8 deletions(-) diff --git a/src/declarativeimports/core/ToolTip.qml b/src/declarativeimports/core/ToolTip.qml index 21e1daf88..fa7d91f11 100644 --- a/src/declarativeimports/core/ToolTip.qml +++ b/src/declarativeimports/core/ToolTip.qml @@ -19,6 +19,8 @@ import QtQuick 2.0 import org.kde.plasma.core 2.0 as PlasmaCore +import org.kde.plasma.components 2.0 as PlasmaComponents +import org.kde.plasma.extras 2.0 as PlasmaExtras /** * This is a Plasma-themed tooltip. It is rendered in its own window @@ -37,6 +39,8 @@ import org.kde.plasma.core 2.0 as PlasmaCore */ MouseArea { + property int _s: theme.iconSizes.small / 2 + hoverEnabled: true onEntered: { print("entere"); @@ -73,19 +77,56 @@ MouseArea { mainItem: PlasmaCore.FrameSvgItem { id: toolTipSvg imagePath: "widgets/tooltip" - width: childrenRect.width + 50 - height: childrenRect.height + 50 + width: childrenRect.width + margins.left + margins.right + height: childrenRect.height + margins.top + margins.bottom + + onWidthChanged: print("XXXX ====================================== svgframe width: " + width) + onChildrenRectChanged: print("XXXX childrenRect chagned" + childrenRect.width + " " + childrenRect.height) Item { - width: 300 - height: 200 + id: toolTipContentItem + x: toolTipSvg.margins.left + y: toolTipSvg.margins.top + width: childrenRect.width + height: childrenRect.height anchors { topMargin: parent.anchors.margins.top leftMargin: parent.anchors.margins.left - fill: parent + //fill: parent + } + + PlasmaCore.IconItem { + id: tooltipIcon + width: theme.iconSizes.desktop + height: width + source: "zanshin" +// anchors { +// left: parent.left +// verticalCenter: parent.verticalCenter +// } + } + PlasmaExtras.Heading { + id: tooltipMaintext + level: 4 + text: "Emperor fish sighted" + anchors { + left: tooltipIcon.right + leftMargin: _s + //right: parent.right + top: parent.top + } + } + PlasmaComponents.Label { + id: tooltipSubtext + text: "You've come across a beautiful sea creature" + anchors { + left: tooltipIcon.right + leftMargin: _s + topMargin: _s + //right: parent.right + top: tooltipMaintext.bottom + } } - id: toolTipContentItem - Rectangle { width: 280; height: 140; color: "orange"; } } diff --git a/src/declarativeimports/core/tooltip.cpp b/src/declarativeimports/core/tooltip.cpp index 398a92307..60f6767bd 100644 --- a/src/declarativeimports/core/tooltip.cpp +++ b/src/declarativeimports/core/tooltip.cpp @@ -221,7 +221,7 @@ void ToolTipWindow::setMainItem(QQuickItem *mainItem) //resize(mainItem->width(), mainItem->height()); - resize(200, 200); + resize(400, 200); if (m_mainItem.data() != mainItem) { if (m_mainItem) { m_mainItem.data()->setParent(parent());