mirror of
https://github.com/mappu/miqt.git
synced 2024-12-22 00:48:38 +00:00
qtscript: add example
This commit is contained in:
parent
2526335d5d
commit
10d01df372
1
.gitignore
vendored
1
.gitignore
vendored
@ -33,6 +33,7 @@ examples/libraries/extras-scintillaedit/extras-scintillaedit
|
||||
examples/libraries/qt-multimedia/qt-multimedia
|
||||
examples/libraries/qt-network/qt-network
|
||||
examples/libraries/qt-printsupport/qt-printsupport
|
||||
examples/libraries/qt-script/qt-script
|
||||
examples/libraries/qt-svg/qt-svg
|
||||
examples/libraries/qt6-multimedia/qt6-multimedia
|
||||
examples/libraries/restricted-extras-qscintilla/restricted-extras-qscintilla
|
||||
|
23
examples/libraries/qt-script/main.go
Normal file
23
examples/libraries/qt-script/main.go
Normal file
@ -0,0 +1,23 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
|
||||
"github.com/mappu/miqt/qt"
|
||||
"github.com/mappu/miqt/qt/script"
|
||||
)
|
||||
|
||||
func main() {
|
||||
|
||||
qt.NewQApplication(os.Args)
|
||||
|
||||
inputProgram := "1 + 2"
|
||||
|
||||
eng := script.NewQScriptEngine()
|
||||
result := eng.Evaluate(inputProgram)
|
||||
|
||||
fmt.Printf("%s = %1.f\n", inputProgram, result.ToNumber())
|
||||
|
||||
// qt.QApplication_Exec()
|
||||
}
|
Loading…
Reference in New Issue
Block a user