Thursday, April 29, 2010

Spring short vacation 2010

In Japan, last week of April and first week of May are short vacation weeks. Of course, I take a short vacation, so I suspend posts and comments to this blog for a moment. Resume will be May 10, 2010.

Monday, April 26, 2010

Your Linux can become to develop Qt applications for symbian

These sources (1, 2) are explaining approaches to develop Qt applications for symbian on your Linux.

If you are a Linux guru or a Linux user, and you are interested in developing open mobile application, these posts are good solution. Especially, openSUSE may be most suitable distribution because openSUSE is most friendly for Qt.

Friday, April 23, 2010

Mouse event on QML

How do we hook the call back event like mouse click to the QML applications? The most QML-ish way to do that is to set the element like XXXXArea. This sample shows changing the text colot when mouse buttons (left or right) are clickked with concrete element MouseArea.

At first, see the MouseArea and its parent element:
    Text {
        id: original
        x: 60
        y: 80
        text: qsTr("Hello World")
        MouseArea {
            /* inherit parent item area to handle click event
                because default area is none */
            anchors.fill: parent
            /* write acceptable buttons
                because there are no default button events*/
            acceptedButtons: Qt.LeftButton | Qt.RightButton
            onClicked: { // hooked event when mouse is clicked
                if (mouse.button == Qt.RightButton) {
                    parent.color = 'black';
                } else {
                    parent.color = 'red';
                }
            }
        }
    }

Tuesday, April 20, 2010

Rotate QML Text

Like this post, we can rotate text easily with Rotate element.
import Qt 4.7

Rectangle {
    width: 200
    height: 200
    Text {
        id: original
        x: 60
        y: 80
        text: qsTr("Hello World")
    }
    Text {
        x: original.x
        y: original.y + 16
        text: original.text + "!"
        font {
            family: "Helvetica"
            pointSize: 12
            italic: true
        }
        color: "blue"
        transform: Rotation {
            angle: 45
        } // rotate this text item
    }
}
And let's be smooth the text:
        transform: Rotation {
            angle: 45
        } // rotate this text item
        smooth: true // smooth the transformation of this text

Saturday, April 17, 2010

Change the scale of QML text

Using transform property and Scale element, we can change the scale of QML text.
import Qt 4.7

Rectangle {
    width: 200
    height: 200
    Text {
        id: original
        x: 60
        y: 80
        text: qsTr("Hello World")
    }
    Text {
        x: original.x
        y: original.y + 16
        text: original.text + "!"
        font {
            family: "Helvetica"
            pointSize: 12
            italic: true
        }
        color: "blue"
        transform: Scale {
            xScale: 1.25
            yScale: 5
        } // change the scale of this text item
    }
}
But this font is dirty. Then let's be smooth.
        transform: Scale {
            xScale: 1.25
            yScale: 5
        } // change the scale of this text item
        smooth: true // smooth the transformation of this text
Re-run the QML application: