tests/auto/declarative/qdeclarativefocusscope/data/forcefocus.qml
branchGCC_SURGE
changeset 31 5daf16870df6
parent 30 5dc02b23752f
child 33 3e2da88830cd
equal deleted inserted replaced
27:93b982ccede2 31:5daf16870df6
       
     1 import Qt 4.7
       
     2 
       
     3 Rectangle {
       
     4     width: 800; height: 600
       
     5 
       
     6     FocusScope {
       
     7         focus: true
       
     8 
       
     9         FocusScope {
       
    10             id: firstScope
       
    11             focus: true
       
    12 
       
    13             Rectangle {
       
    14                 objectName: "item0"
       
    15                 height: 120; width: 420
       
    16 
       
    17                 color: "transparent"
       
    18                 border.width: 5; border.color: firstScope.wantsFocus?"blue":"black"
       
    19 
       
    20                 Rectangle {
       
    21                     id: item1; objectName: "item1"
       
    22                     x: 10; y: 10; width: 100; height: 100; color: "green"
       
    23                     border.width: 5; border.color: wantsFocus?"blue":"black"
       
    24                     focus: true
       
    25 
       
    26                     Rectangle {
       
    27                         width: 50; height: 50; anchors.centerIn: parent
       
    28                         color: parent.focus?"red":"transparent"
       
    29                     }
       
    30                 }
       
    31 
       
    32                 Rectangle {
       
    33                     id: item2; objectName: "item2"
       
    34                     x: 310; y: 10; width: 100; height: 100; color: "green"
       
    35                     border.width: 5; border.color: wantsFocus?"blue":"black"
       
    36 
       
    37                     Rectangle {
       
    38                         width: 50; height: 50; anchors.centerIn: parent
       
    39                         color: parent.focus?"red":"transparent"
       
    40                     }
       
    41                 }
       
    42             }
       
    43         }
       
    44 
       
    45         FocusScope {
       
    46             id: secondScope
       
    47 
       
    48             Rectangle {
       
    49                 objectName: "item3"
       
    50                 y: 160; height: 120; width: 420
       
    51 
       
    52                 color: "transparent"
       
    53                 border.width: 5; border.color: secondScope.wantsFocus?"blue":"black"
       
    54 
       
    55                 Rectangle {
       
    56                     id: item4; objectName: "item4"
       
    57                     x: 10; y: 10; width: 100; height: 100; color: "green"
       
    58                     border.width: 5; border.color: wantsFocus?"blue":"black"
       
    59 
       
    60                     Rectangle {
       
    61                         width: 50; height: 50; anchors.centerIn: parent
       
    62                         color: parent.focus?"red":"transparent"
       
    63                     }
       
    64                 }
       
    65 
       
    66                 Rectangle {
       
    67                     id: item5; objectName: "item5"
       
    68                     x: 310; y: 10; width: 100; height: 100; color: "green"
       
    69                     border.width: 5; border.color: wantsFocus?"blue":"black"
       
    70 
       
    71                     Rectangle {
       
    72                         width: 50; height: 50; anchors.centerIn: parent
       
    73                         color: parent.focus?"red":"transparent"
       
    74                     }
       
    75                 }
       
    76             }
       
    77         }
       
    78     }
       
    79     Keys.onDigit4Pressed: item4.focus = true
       
    80     Keys.onDigit5Pressed: item5.forceFocus()
       
    81 }