Warning, /rolisteam/rolisteam/src/libraries/charactersheet/qml/Rolisteam/DiceButtonv1.qml is written in an unsupported language. File is not indexed.

0001 import QtQuick 2.0
0002 import QtQuick 2.4
0003 import QtQuick.Controls 1.3
0004 
0005 Rectangle {
0006     id:root
0007     property alias text : textInput.text
0008     property alias textColor: textInput.color
0009     property alias hAlign: textInput.horizontalAlignment
0010     property alias font: textInput.font
0011     property alias wrapMode: textInput.wrapMode
0012 
0013     property alias vAlign: textInput.verticalAlignment
0014     property bool readOnly: false
0015     scale: mouseZone.pressed ? 0.8 : 1.0
0016     signal clicked
0017     Text {//textInput.textColor
0018         id: textInput
0019         anchors.fill: parent
0020         clip: true
0021         onWidthChanged: {
0022             computeSizeFont();
0023         }
0024         MouseArea {
0025             id: mouseZone
0026             anchors.fill: parent
0027             onClicked:  root.clicked()
0028             enabled: !root.readOnly
0029         }
0030 
0031         function computeSizeFont()
0032         {
0033             if(parent.clippedText)
0034             {
0035                 while((contentWidth>root.width)&&(font.pointSize>1)&&(root.width>0))
0036                 {
0037                     font.pointSize-=1
0038                 }
0039                 while((contentWidth+2<width)&&(contentHeight+2<height))
0040                 {
0041                     font.pointSize+=1
0042                 }
0043             }
0044         }
0045     }
0046 }