mirror of https://github.com/cutefishos/calculator
				
				
				
			
			You cannot select more than 25 topics
			Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
		
		
		
		
		
			
		
			
				
	
	
		
			49 lines
		
	
	
		
			1.1 KiB
		
	
	
	
		
			QML
		
	
			
		
		
	
	
			49 lines
		
	
	
		
			1.1 KiB
		
	
	
	
		
			QML
		
	
import QtQuick 2.12
 | 
						|
import QtQuick.Controls 2.5
 | 
						|
import QtQuick.Layouts 1.3
 | 
						|
import Cutefish.Calculator 1.0
 | 
						|
import MeuiKit 1.0 as Meui
 | 
						|
 | 
						|
Meui.Window {
 | 
						|
    visible: true
 | 
						|
    width: 350
 | 
						|
    height: 550
 | 
						|
    minimumWidth: 350
 | 
						|
    minimumHeight: 550
 | 
						|
    title: qsTr("Calculator")
 | 
						|
    id: rootWindow
 | 
						|
 | 
						|
    backgroundColor: Meui.Theme.darkMode ? Qt.rgba(46 / 255, 46 / 255, 46 / 255, 1.0)
 | 
						|
                                         : Qt.rgba(240 / 255, 238 / 255, 241 / 255, 1.0)
 | 
						|
 | 
						|
    CalcEngine {
 | 
						|
        id: calcEngine
 | 
						|
 | 
						|
        Component.onCompleted: {
 | 
						|
            console.log("load calc engine finished")
 | 
						|
        }
 | 
						|
    }
 | 
						|
 | 
						|
    ColumnLayout {
 | 
						|
        anchors.fill: parent
 | 
						|
        spacing: Meui.Units.smallSpacing
 | 
						|
 | 
						|
        Zone {
 | 
						|
            id: zone
 | 
						|
            Layout.fillWidth: true
 | 
						|
            Layout.preferredHeight: parent.height * 0.35
 | 
						|
        }
 | 
						|
 | 
						|
        StandardPad {
 | 
						|
            Layout.fillWidth: true
 | 
						|
            Layout.fillHeight: true
 | 
						|
            onPressed: zone.appendToTextField(text)
 | 
						|
        }
 | 
						|
    }
 | 
						|
 | 
						|
    function calculate(evalText) {
 | 
						|
        var res = calcEngine.eval(evalText)
 | 
						|
        return res
 | 
						|
    }
 | 
						|
}
 |