QGCRadioButton.qml 1.45 KB
Newer Older
Don Gagne's avatar
Don Gagne committed
1 2 3 4 5
import QtQuick 2.2
import QtQuick.Controls 1.2
import QtQuick.Controls.Styles 1.2

import QGroundControl.Palette 1.0
6
import QGroundControl.ScreenTools 1.0
Don Gagne's avatar
Don Gagne committed
7 8

RadioButton {
Don Gagne's avatar
Don Gagne committed
9 10 11
    property var color: _qgcPal.text    ///< Text color

    property var _qgcPal: QGCPalette { colorGroupEnabled: enabled }
Don Gagne's avatar
Don Gagne committed
12 13 14

    style: RadioButtonStyle {
        label: Item {
dogmaphobic's avatar
dogmaphobic committed
15 16 17
            implicitWidth:          text.implicitWidth + ScreenTools.defaultFontPixelWidth * 0.25
            implicitHeight:         text.implicitHeight
            baselineOffset:         text.y + text.baselineOffset
Don Gagne's avatar
Don Gagne committed
18
            Rectangle {
dogmaphobic's avatar
dogmaphobic committed
19 20
                anchors.fill:       text
                anchors.margins:    -1
Don Gagne's avatar
Don Gagne committed
21
                anchors.leftMargin: -3
dogmaphobic's avatar
dogmaphobic committed
22 23 24 25 26 27 28
                anchors.rightMargin:-3
                visible:            control.activeFocus
                height:             ScreenTools.defaultFontPixelWidth * 0.25
                radius:             height * 0.5
                color:              "#224f9fef"
                border.color:       "#47b"
                opacity:            0.6
Don Gagne's avatar
Don Gagne committed
29 30
            }
            Text {
dogmaphobic's avatar
dogmaphobic committed
31 32 33 34 35
                id:                 text
                text:               control.text
                font.pointSize:     ScreenTools.defaultFontPointSize
                font.family:        ScreenTools.normalFontFamily
                antialiasing:       true
Don Gagne's avatar
Don Gagne committed
36
                color:              control.color
dogmaphobic's avatar
dogmaphobic committed
37
                anchors.centerIn:   parent
Don Gagne's avatar
Don Gagne committed
38 39 40 41
            }
        }
    }
}