Debian Codegraph @

examples/calculator/components/Functions.qml

raw
1 /*
2 * Copyright 2013 Canonical Ltd.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU Lesser General Public License as published by
6 * the Free Software Foundation; version 3.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU Lesser General Public License for more details.
12 *
13 * You should have received a copy of the GNU Lesser General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 *
16 * Author: Zsombor Egri <[email protected]>
17 */
18
19 import QtQuick 2.0
20 import Lomiri.Components 1.3
21 import Lomiri.Layouts 1.0
22
23 Grid {
24 id: buttonGrid
25 columns: 4
26 rows: 7
27 spacing: units.gu(1)
28
29 property var operations
30
31 Repeater {
32 model: [
33 "%", "1/x", "x!", "x^2",
34 "x^3", "x^y", "2^x", "sqrt",
35 "ln", "e^x", "sin()", "cos()",
36 "tan()", "cot()", "sec()", "csc()",
37 ]
38 delegate: Button {
39 text: modelData
40 width: (buttonGrid.width - 3 * buttonGrid.spacing) / 4
41 height: (buttonGrid.height - 3 * buttonGrid.spacing) / 4
42 onClicked: operations.execute(modelData)
43 }
44 }
45
46 }