~f-riccardo87/ubuntu-calculator-app/new-design

« back to all changes in this revision

Viewing changes to KeyboardsView.qml

  • Committer: Tarmac
  • Author(s): Dalius, Riccardo Ferrazzo
  • Date: 2013-02-24 14:32:52 UTC
  • mfrom: (7.1.21 ubuntu-calculator-app)
  • Revision ID: tarmac-20130224143252-lz4puf6xvq515jtt
Many UI improvements. More scientific buttons.

Approved by Riccardo Ferrazzo.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
import QtQuick 2.0
 
2
 
 
3
Flickable {
 
4
    id: keyboardsView
 
5
    width: parent.width
 
6
    clip: true
 
7
 
 
8
    contentWidth: stdKeyboard.width
 
9
    contentHeight: stdKeyboard.height
 
10
 
 
11
    property double buttonRowHeight: units.gu(8);
 
12
 
 
13
    onMovementEnded: {
 
14
       var stopPositionInRow = contentY % buttonRowHeight
 
15
       if( Math.abs(stopPositionInRow) > (buttonRowHeight/2)) {
 
16
            contentY += (buttonRowHeight - stopPositionInRow)
 
17
       }
 
18
       else {
 
19
            contentY -=  stopPositionInRow
 
20
       }
 
21
    }
 
22
 
 
23
    StdKeyboard {
 
24
        id: stdKeyboard
 
25
        width: keyboardsView.width
 
26
    }
 
27
}