~sil2100/unity-2d/precise-security

« back to all changes in this revision

Viewing changes to places/Section.qml

  • Committer: Aurelien Gateau
  • Date: 2010-11-10 08:57:29 UTC
  • mto: This revision was merged to the branch mainline in revision 284.
  • Revision ID: aurelien.gateau@canonical.com-20101110085729-fl1ye7impkqhm0w6
Added a section about const correct-ness

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
import Qt 4.7
 
2
 
 
3
AbstractButton {
 
4
    property alias label: label.text
 
5
    property bool active: false
 
6
    property int horizontalPadding: 0
 
7
    property int verticalPadding: 0
 
8
 
 
9
    width: label.width + horizontalPadding*2
 
10
    height: label.height + verticalPadding*2
 
11
 
 
12
    Rectangle {
 
13
        anchors.fill: parent
 
14
        opacity: active || parent.state == "selected" || parent.state == "pressed" ? 1.0 : 0.0
 
15
 
 
16
        color: active || parent.state == "pressed" ? "#ffffffff" : "#00000000"
 
17
        border.color: "#cccccc"
 
18
        border.width: 1
 
19
        radius: 3
 
20
 
 
21
        Behavior on opacity {NumberAnimation {duration: 100}}
 
22
 
 
23
        Image {
 
24
            fillMode: Image.Tile
 
25
            anchors.fill: parent
 
26
            source: "artwork/button_background.png"
 
27
            smooth: false
 
28
        }
 
29
    }
 
30
 
 
31
    TextCustom {
 
32
        id: label
 
33
 
 
34
        width: paintedWidth
 
35
        height: paintedHeight
 
36
        anchors.verticalCenter: parent.verticalCenter
 
37
        anchors.horizontalCenter: parent.horizontalCenter
 
38
 
 
39
        color: active || parent.state == "pressed" ? "#444444" : "#ffffff"
 
40
        horizontalAlignment: Text.AlignHCenter
 
41
    }
 
42
}