Create component to wrap text and icon

This commit is contained in:
Angela Mazzurco 2017-06-23 18:37:49 +02:00
parent b848422a2d
commit fd38129b09
2 changed files with 38 additions and 0 deletions

View File

@ -0,0 +1,37 @@
import QtQuick 2.0
import QtQuick.Controls 2.0
ToolButton
{
height: icon.height + 5
property alias iconUrl: icon.source
property alias innerText: innerText.text
Image
{
id: icon
height: innerText.contentHeight
width: innerText.contentHeight
fillMode: Image.PreserveAspectFit
anchors.left: parent.left
anchors.leftMargin: 4
anchors.verticalCenter: parent.verticalCenter
}
Text
{
id: innerText
wrapMode: Text.WrapAnywhere
anchors.horizontalCenter: parent.horizontalCenter
anchors.verticalCenter: parent.verticalCenter
anchors.left: icon.right
anchors.leftMargin: 5
}
}

View File

@ -46,5 +46,6 @@
<file>icons/exit.svg</file>
<file>icons/add.svg</file>
<file>icons/keyring.svg</file>
<file>components/TextAndIcon.qml</file>
</qresource>
</RCC>