initial commit
This commit is contained in:
commit
761383ef3c
|
@ -0,0 +1,8 @@
|
|||
.idea
|
||||
deploy
|
||||
moc*
|
||||
rcc*
|
||||
*.qmlc
|
||||
*.jsc
|
||||
vendor/
|
||||
.directory
|
|
@ -0,0 +1,8 @@
|
|||
module git.openprivacy.ca/erinn/qmltest
|
||||
|
||||
go 1.12
|
||||
|
||||
require (
|
||||
git.openprivacy.ca/openprivacy/libricochet-go v1.0.6
|
||||
github.com/therecipe/qt v0.0.0-20190914193131-4c875570321e
|
||||
)
|
|
@ -0,0 +1,33 @@
|
|||
git.openprivacy.ca/openprivacy/libricochet-go v1.0.6 h1:5o4K2qn3otEE1InC5v5CzU0yL7Wl7DhVp4s8H3K6mXY=
|
||||
git.openprivacy.ca/openprivacy/libricochet-go v1.0.6/go.mod h1:yMSG1gBaP4f1U+RMZXN85d29D39OK5s8aTpyVRoH5FY=
|
||||
github.com/agl/ed25519 v0.0.0-20170116200512-5312a6153412/go.mod h1:WPjqKcmVOxf0XSf3YxCJs6N6AOSrOx3obionmG7T0y0=
|
||||
github.com/cretz/bine v0.1.0/go.mod h1:6PF6fWAvYtwjRGkAuDEJeWNOv3a2hUouSP/yRYXmvHw=
|
||||
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
|
||||
github.com/gopherjs/gopherjs v0.0.0-20190411002643-bd77b112433e h1:XWcjeEtTFTOVA9Fs1w7n2XBftk5ib4oZrhzWk0B+3eA=
|
||||
github.com/gopherjs/gopherjs v0.0.0-20190411002643-bd77b112433e/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY=
|
||||
github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
|
||||
github.com/konsorten/go-windows-terminal-sequences v1.0.2/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
|
||||
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
||||
github.com/sirupsen/logrus v1.4.1/go.mod h1:ni0Sbl8bgC9z8RoU9G6nDWqqs/fq4eDPysMBDgk/93Q=
|
||||
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
||||
github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
||||
github.com/stretchr/objx v0.2.0/go.mod h1:qt09Ya8vawLte6SNmTgCsAVtYtaKzEcn8ATUoHMkEqE=
|
||||
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
|
||||
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
|
||||
github.com/therecipe/qt v0.0.0-20190914193131-4c875570321e h1:ralwiYe77HLSNZzbnnfu0BlC+6AbgzwHjGB5hg5sL7s=
|
||||
github.com/therecipe/qt v0.0.0-20190914193131-4c875570321e/go.mod h1:SUUR2j3aE1z6/g76SdD6NwACEpvCxb3fvG82eKbD6us=
|
||||
golang.org/x/crypto v0.0.0-20190128193316-c7b33c32a30b/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
|
||||
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
|
||||
golang.org/x/crypto v0.0.0-20190418165655-df01cb2cc480/go.mod h1:WFFai1msRO1wXaEeE5yQxYXgSfI8pQAWXbQop6sCtWE=
|
||||
golang.org/x/net v0.0.0-20190125091013-d26f9f9a57f3/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||
golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
|
||||
golang.org/x/net v0.0.0-20190420063019-afa5a82059c6/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
|
||||
golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
golang.org/x/sys v0.0.0-20190403152447-81d4e9dc473e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20190419153524-e8e3143a4f4a/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||
golang.org/x/tools v0.0.0-20190420181800-aa740d480789/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
|
|
@ -0,0 +1,56 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"flag"
|
||||
"git.openprivacy.ca/openprivacy/libricochet-go/log"
|
||||
"github.com/therecipe/qt/core"
|
||||
"github.com/therecipe/qt/gui"
|
||||
"github.com/therecipe/qt/qml"
|
||||
"github.com/therecipe/qt/quickcontrols2"
|
||||
"os"
|
||||
)
|
||||
|
||||
type Thingama struct {
|
||||
core.QObject
|
||||
|
||||
_ string `property:"x"`
|
||||
_ core.QStringList `property:"mahdahl"`
|
||||
_ core.QAbstractItemModel `property:"abstracty"`
|
||||
|
||||
_ func() `signal:"doTheThing,auto"`
|
||||
}
|
||||
|
||||
func (this *Thingama) doTheThing() {
|
||||
}
|
||||
|
||||
func main() {
|
||||
flagDebug := flag.Bool("debug", false, "turn on extra logging. WARNING: THIS MAY EXPOSE PRIVATE INFORMATION IN CONSOLE OUTPUT!")
|
||||
flagLocal := flag.Bool("local", false, "load user interface from the local folder \"qml\" instead of the built-in UI")
|
||||
flag.Parse()
|
||||
|
||||
if *flagDebug {
|
||||
log.SetLevel(log.LevelDebug)
|
||||
} else {
|
||||
log.SetLevel(log.LevelInfo)
|
||||
}
|
||||
|
||||
// this is to load local qml files quickly when developing
|
||||
var qmlSource *core.QUrl
|
||||
if *flagLocal {
|
||||
qmlSource = core.QUrl_FromLocalFile("./qml/main.qml")
|
||||
} else {
|
||||
qmlSource = core.NewQUrl3("qrc:/qml/main.qml", 0)
|
||||
}
|
||||
|
||||
app := gui.NewQGuiApplication(len(os.Args), os.Args)
|
||||
core.QCoreApplication_SetAttribute(core.Qt__AA_EnableHighDpiScaling, true)
|
||||
quickcontrols2.QQuickStyle_SetStyle("Default")
|
||||
engine := qml.NewQQmlApplicationEngine(nil)
|
||||
|
||||
thingama := NewThingama(nil)
|
||||
thingama.SetX("hello")
|
||||
engine.RootContext().SetContextProperty("thingama", thingama)
|
||||
|
||||
engine.Load(qmlSource)
|
||||
app.Exec()
|
||||
}
|
|
@ -0,0 +1,37 @@
|
|||
import QtGraphicalEffects 1.0
|
||||
import QtQuick 2.7
|
||||
import QtQuick.Controls 2.4
|
||||
import QtQuick.Controls.Material 2.0
|
||||
import QtQuick.Layouts 1.3
|
||||
import QtQuick.Window 2.11
|
||||
import QtQuick.Controls.Styles 1.4
|
||||
import QtQuick.Controls 1.4
|
||||
|
||||
|
||||
RowLayout {
|
||||
id: sec
|
||||
property int base: 10
|
||||
|
||||
Text {
|
||||
font.pointSize: sec.base
|
||||
text: "pointSize: " + font.pointSize
|
||||
}
|
||||
|
||||
TextField {
|
||||
text: "pt" + sec.base + "; ptToPx("+sec.base+")"
|
||||
style: TextFieldStyle {
|
||||
id: root
|
||||
textColor: "black"
|
||||
font.pointSize: sec.base
|
||||
property int width: 500
|
||||
|
||||
background: Rectangle {
|
||||
radius: 2
|
||||
implicitWidth: root.width
|
||||
implicitHeight: ptToPx(sec.base)
|
||||
//color: windowItem.cwtch_background_color
|
||||
border.color: "#000000"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,35 @@
|
|||
import QtGraphicalEffects 1.0
|
||||
import QtQuick 2.7
|
||||
import QtQuick.Controls 2.4
|
||||
import QtQuick.Controls.Material 2.0
|
||||
import QtQuick.Layouts 1.3
|
||||
import QtQuick.Window 2.11
|
||||
import QtQuick.Controls.Styles 1.4
|
||||
import QtQuick.Controls 1.4
|
||||
|
||||
ApplicationWindow {
|
||||
id: windowItem
|
||||
width: 1200
|
||||
height: 800
|
||||
visible: true
|
||||
title: "qmltest"
|
||||
style: ApplicationWindowStyle {
|
||||
background: Rectangle { color: "#FFFFFF"; anchors.fill: parent; }
|
||||
}
|
||||
|
||||
function ptToPx(pt) {
|
||||
return Screen.pixelDensity * 25.4 * pt / 72
|
||||
}
|
||||
|
||||
function pxToPt(px) {
|
||||
return px * 72 / (Screen.pixelDensity * 25.4)
|
||||
}
|
||||
|
||||
ColumnLayout {
|
||||
TestRow { base: 10 }
|
||||
TestRow { base: 16 }
|
||||
TestRow { base: 24 }
|
||||
TestRow { base: 36 }
|
||||
TestRow { base: 48 }
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue