Comments (10)
Ok, I figured out, renamed ui/ dir to qml/ and changed paths inside .ui files.
Is there a way to generate just qrc.go without qtdeploy? I would like to use just go build without qtdeploy with my static Qt build in chroot.
Still, something is strange when you try to load pixmap from byte/string, or I am doing something wrong there?
from qt.
Hey
Currently the qrc.* files are generated on the fly by qtdeploy.
The qrc.go file just contains a few LDFLAGS and can be reused, if you can obtain a copy while executing qtdeploy.
The qrc.qrc and qrc.cpp files are created with Qt's rcc tool.
You can also take a look here, to see how its handled in qtdeploy.
It's probably simpler if you use rcc directly, instead of me exposing it through qtdeploy or something?
And yes, the QPixmap.LoadFromData functions are currently broken. (As well as a few other functions which use QByteArray)
I made a mistake by mapping QByteArray to Go's string instead of []byte.
But I will fix this in an upcoming release.
For now you can only load it from the filesystem or if you use rcc you can also load it with qrc:///
from qt.
Hi,
Ok, I can just use rcc directly, I thought qtdeploy does more.
I am having issue currently with loading html file from resources. Icons in .ui files work but something like this loads file randomly (e.g. every 5th time)
var res string
file := core.NewQFile2(":/qml/assets/view.html")
file.Open(core.QIODevice__ReadOnly)
if file.IsOpen() {
res = file.ReadAll()
}
file.Close()
Hopefully, this will be fixed in upcoming release. Thanks!
from qt.
Hey
Beside the qrc/rcc support, qtdeploy handles also a few other things:
- Moc support to create your own subclasses with signals/slots
- Dynamically rebuilds the minimal version of the binding to make the executable smaller
- Handles the packaging (macdeploy, windeploy, ...) of the application for the different systems
But if you don't need those features, you can as well just build your executable with go build.
I also tested loading of html files from resource files and it works for me.
Could you provide a small code sample, so I can reproduce the error on my end?
package main
import (
"crypto/sha1"
"encoding/hex"
"fmt"
"github.com/therecipe/qt/core"
)
func main() {
var check string
for i := 0; i < 1000; i++ {
var (
res string
file = core.NewQFile2(":/qml/assets/view.html")
)
file.Open(core.QIODevice__ReadOnly)
if file.IsOpen() {
res = file.ReadAll()
}
file.Close()
var sum = sha1.Sum([]byte(res))
if i == 0 {
check = hex.EncodeToString(sum[:])
}
if hash := hex.EncodeToString(sum[:]); hash != check {
fmt.Printf("%v: %v != %v\n", i, hash, check)
}
}
}
from qt.
Ok, that is similar to what I was trying to do. Only difference is I had something like this in view.html
<script
type="text/javascript" src="qrc:///qml/assets/js/jquery.js"></script>`
I don't have files currently, I will post sample as soon as I can.
I tried already to build moc files with qtmoc, for resource files I saved the ones generated from qtdeploy and go build works. I just don't understand how to use minimal builds, if I use -tags minimal then build complains that it can not find uitools.
from qt.
Do you use the uitools package in your code?
Does it work if you don't use the minimal tag?
The minimal function, to dynamically rebuild the binding files is currently only executed if you use qtdeploy.
The files are created with a -minimal.*
suffix in the core, gui, widgets, uitools, ...
folders.
Mabye there are no -minimal.*
files in the uitools
folder?
from qt.
Yes, I use uitools in code, it worked without minimal tag and after I rebuilt everything with setup.sh it works now also with go build -tags minimal, the resulting binary after strip is same size as in deploy/linux_minimal when qtdeploy is used. I can now try to use it with my static build of Qt.
I cannot reproduce anymore error with loading html file, and I don't try to use webengine anymore, I will just use plain Qt components. The only issue I have now is with LoadFromData2 function as I am trying to load remote images.
Thanks
from qt.
I will look into this.
from qt.
Fixed it 2db75f9
This works now https://gist.github.com/gen2brain/2d56084e797d98cf26703142613d438b
from qt.
It works :) Thanks!
from qt.
Related Issues (20)
- deploying linux to windows build fail with newqwebengineview. thanks for your help HOT 4
- Is alive? HOT 1
- Issue with using *QFileDialog.SelectedFiles(), "interface conversion: interface {} is []interface {}, not []string" HOT 1
- /usr/bin/ld: i386 architecture of input file `/tmp/go-link-3590783856/000000.o' is incompatible with i386:x86-64 output HOT 2
- Is there an active fork of this project? HOT 8
- android APK crashes when launched
- Installation fails for Qt 6 HOT 2
- !!! Read before opening a new issue !!!
- qtdeploy may not work with Go1.20 HOT 1
- go: warning: "github.com/therecipe/qt/cmd/..." matched no packages HOT 1
- menu.Actions() panics
- How to add a property sheet file to Qt
- How can I deploy a program to an arm development board and don't see a good way
- Intermittent Qtdeploy Failures HOT 1
- Gave up - Docs need some work for new people HOT 1
- is this project still maintains, what's the latest qt version does it support HOT 2
- qtsetup fails
- qtsetup error in freebsd 14.1 HOT 1
- New and working linux_static deployment dockerfile
- gui.NewQPixmap3() have a requestion?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from qt.