Git Product home page Git Product logo

therecipe / qt Goto Github PK

View Code? Open in Web Editor NEW
10.2K 309.0 732.0 171.84 MB

Qt binding for Go (Golang) with support for Windows / macOS / Linux / FreeBSD / Android / iOS / Sailfish OS / Raspberry Pi / AsteroidOS / Ubuntu Touch / JavaScript / WebAssembly

License: GNU Lesser General Public License v3.0

Go 84.98% C++ 2.40% C 1.30% Shell 0.09% QML 8.83% JavaScript 1.25% HTML 0.04% Java 0.03% Batchfile 0.04% Dockerfile 0.13% GLSL 0.90%
go gui-framework qt cross-platform-gui windows macos linux android ios sailfish-os

qt's Introduction

Introduction

Qt is a free and open-source widget toolkit for creating graphical user interfaces as well as cross-platform applications that run on various software and hardware platforms with little or no change in the underlying codebase.

Go, also known as Golang, is a programming language designed at Google.

therecipe/qt allows you to write Qt applications entirely in Go, JavaScript/TypeScript, Dart/Flutter, Haxe and Swift

Beside the language bindings provided, therecipe/qt also greatly simplifies the deployment of Qt applications to various software and hardware platforms.

At the time of writing, almost all Qt functions and classes are accessible, and you should be able to find everything you need to build fully featured Qt applications.

Impressions

Gallery of example applications.

JavaScript Demo | source

Installation

The following instructions assume that you already installed Go and Git

(Experimental) cgo-less version (try this first, if you are new and want to test the binding)

Windows
go get -ldflags="-w" github.com/therecipe/examples/basic/widgets && for /f %v in ('go env GOPATH') do %v\bin\widgets.exe
macOS/Linux
go get -ldflags="-w" github.com/therecipe/examples/basic/widgets && $(go env GOPATH)/bin/widgets

Default version

Windows (more info)
set GO111MODULE=off
go get -v github.com/therecipe/qt/cmd/... && for /f %v in ('go env GOPATH') do %v\bin\qtsetup test && %v\bin\qtsetup -test=false
export GO111MODULE=off; xcode-select --install; go get -v github.com/therecipe/qt/cmd/... && $(go env GOPATH)/bin/qtsetup test && $(go env GOPATH)/bin/qtsetup -test=false
export GO111MODULE=off; go get -v github.com/therecipe/qt/cmd/... && $(go env GOPATH)/bin/qtsetup test && $(go env GOPATH)/bin/qtsetup -test=false

Resources

Deployment Targets

Target Arch Linkage Docker Deployment Host OS
Windows 32 / 64 dynamic / static Yes Any
macOS 64 dynamic Yes Any
Linux arm / arm64 / 64 dynamic / static / system Yes Any
Android (+Wear) arm / arm64 dynamic Yes Any
Android-Emulator (+Wear) 32 dynamic Yes Any
SailfishOS arm system Yes Any
SailfishOS-Emulator 32 system Yes Any
Raspberry Pi (1/2/3) arm dynamic / system Yes Any
Ubuntu Touch arm / 64 system Yes Any
JavaScript 32 static Yes Any
WebAssembly 32 static Yes Any
iOS arm64 static No macOS
iOS-Simulator 64 static No macOS
AsteroidOS arm system No Linux
FreeBSD 32 / 64 system No FreeBSD

License

This package is released under LGPLv3

Qt itself is licensed and available under multiple licenses.

qt's People

Contributors

5k3105 avatar aebruno avatar aelphy avatar akamensky avatar angiglesias avatar apocelipes avatar jeanlucmongrain avatar joesis avatar jordanorelli avatar kenshaw avatar longlongh4 avatar mathyv avatar matt-texier avatar mdobak avatar medvednikov avatar muesli avatar muyuballs avatar nndurj avatar pekim avatar quadtriangle avatar quantonganh avatar r0l1 avatar radhifadlillah avatar rashwell avatar rustatian avatar thegeekpirate avatar therecipe avatar wsw0108 avatar xland avatar zrna-research avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

qt's Issues

Video Widget

Can anyone give an example of using the media player / video widget? I'm having trouble translating the Qt 5.5 examples.. Thanks.

(btw, maybe there should be a forum or google group?)

QGraphicsSceneMouseEvent

    func mousePressEvent(e *widgets.QGraphicsSceneMouseEvent) {
        var color = gui.NewQColor2(160, 160, 160, 255) // r,g,b,a
        var pen = gui.NewQPen3(color)
        pen.SetWidth(1)
        var brush = gui.NewQBrush()

        scene.AddRect2(float64(e.ScreenPos().X()), float64(e.ScreenPos().Y()), 5, 10, pen, brush)

    }

AddRect only accepts a float64. Your version of QGraphicsSceneMouseEvent uses only ScreenPos which returns a QPoint, not QPointF.

Running this, the rectangles appear 100 pixels from where the mouse cursor actually is in the scene.

Maybe I have done something wrong?

I can not build qt

Windows 10 64-bit, Corei7-4790/16Gb RAM
QT = C:\Qt\Qt5.5.1

D:\gosrc\src\github.com\therecipe\qt>go run d:\gosrc/src/github.com/therecipe/qt/internal/setup/generate.go
Generate
core funcs: 4037 (- 981) 4s
androidextras funcs: 43 (- 3) 0
gui funcs: 18704 (- 866) 4s
network funcs: 607 (- 267) 1s
sql funcs: 294 (- 71) 0
xml funcs: 323 (- 117) 0
dbus funcs: 175 (- 81) 0
nfc funcs: 111 (- 37) 0
script funcs: 209 (- 37) 0
sensors funcs: 254 (- 11) 0
positioning funcs: 179 (- 69) 0
widgets funcs: 5088 (- 434) 35s
qml funcs: 281 (- 37) 0
websockets funcs: 71 (- 27) 0
xmlpatterns funcs: 162 (- 50) 0
bluetooth funcs: 207 (- 100) 0
webchannel funcs: 13 (- 2) 0
svg funcs: 60 (- 5) 0
multimedia funcs: 1155 (- 160) 2s
quick funcs: 454 (- 70) 1s
help funcs: 91 (- 10) 0
location funcs: 549 (- 41) 0
scripttools funcs: 14 (- 0) 0
multimediawidgets funcs: 59 (- 5) 0

D:\gosrc\src\github.com\therecipe\qt>if 0 NEQ 0 exit /b 0

D:\gosrc\src\github.com\therecipe\qt>go run d:\gosrc/src/github.com/therecipe/qt/internal/setup/install.go
Install-desktop
core 1m2s
androidextras 0
gui 59s
network 14s
sql 6s
xml 9s
dbus 6s
nfc 4s
script 4s
sensors 16s
positioning 5s
widgets

install.Widgets
output:# github.com/therecipe/qt/widgets
C:\WINDOWS\go-build677055738\github.com\therecipe\qt\widgets_obj_cgo_main.c: In function 'crosscall2':
C:\WINDOWS\go-build677055738\github.com\therecipe\qt\widgets_obj_cgo_main.c:2:23: warning: unused parameter 'fn' [-Wunused-parameter]
void crosscall2(void(fn)(void, int), void _a, int c) { }
^
C:\WINDOWS\go-build677055738\github.com\therecipe\qt\widgets_obj_cgo_main.c:2:46: warning: unused parameter 'a' [-Wunused-parameter]
void crosscall2(void(fn)(void, int), void a, int c) { }
^
C:\WINDOWS\go-build677055738\github.com\therecipe\qt\widgets_obj_cgo_main.c:2:53: warning: unused parameter 'c' [-Wunused-parameter]
void crosscall2(void(_fn)(void
, int), void *a, int c) { }
^
C:\WINDOWS\go-build677055738\github.com\therecipe\qt\widgets_obj_cgo_main.c: In function '_cgo_allocate':
C:\WINDOWS\go-build677055738\github.com\therecipe\qt\widgets_obj_cgo_main.c:5:26: warning: unused parameter 'a' [-Wunused-parameter]
void _cgo_allocate(void *a, int c) { }
^
C:\WINDOWS\go-build677055738\github.com\therecipe\qt\widgets_obj_cgo_main.c:5:33: warning: unused parameter 'c' [-Wunused-parameter]
void _cgo_allocate(void *a, int c) { }
^
C:\WINDOWS\go-build677055738\github.com\therecipe\qt\widgets_obj_cgo_main.c: In function '_cgo_panic':
C:\WINDOWS\go-build677055738\github.com\therecipe\qt\widgets_obj_cgo_main.c:6:23: warning: unused parameter 'a' [-Wunused-parameter]
void _cgo_panic(void *a, int c) { }
^
C:\WINDOWS\go-build677055738\github.com\therecipe\qt\widgets_obj_cgo_main.c:6:30: warning: unused parameter 'c' [-Wunused-parameter]
void _cgo_panic(void *a, int c) { }
^

github.com/therecipe/qt/widgets

d:\gosrc\src\github.com\therecipe\qt\widgets\qapplication.go: In function '_cgo_b12e6e04c547_Cfunc_QApplication_QApplication_AboutQt':
d:\gosrc\src\github.com\therecipe\qt\widgets\qapplication.go:180:49: warning: unused variable 'a' [-Wunused-variable]
}
^
d:\gosrc\src\github.com\therecipe\qt\widgets\qapplication.go: In function '_cgo_b12e6e04c547_Cfunc_QApplication_QApplication_Beep':
d:\gosrc\src\github.com\therecipe\qt\widgets\qapplication.go:235:49: warning: unused variable 'a' [-Wunused-variable]
defer qt.Recovering("QApplication::windowIcon")
^
d:\gosrc\src\github.com\therecipe\qt\widgets\qapplication.go: In function '_cgo_b12e6e04c547_Cfunc_QApplication_QApplication_CloseAllWindows':
d:\gosrc\src\github.com\therecipe\qt\widgets\qapplication.go:244:49: warning: unused variable 'a' [-Wunused-variable]
}
^

github.com/therecipe/qt/widgets

d:\gosrc\src\github.com\therecipe\qt\widgets\qscrollerproperties.go: In function '_cgo_b12e6e04c547_Cfunc_QScrollerProperties_QScrollerProperties_UnsetDefaultScrollerProperties':
d:\gosrc\src\github.com\therecipe\qt\widgets\qscrollerproperties.go:89:49: warning: unused variable 'a' [-Wunused-variable]
QScrollerProperties__FrameRate = QScrollerProperties__ScrollMetric(19)
^

github.com/therecipe/qt/widgets

d:\gosrc\src\github.com\therecipe\qt\widgets\qtooltip.go: In function '_cgo_b12e6e04c547_Cfunc_QToolTip_QToolTip_HideText':
d:\gosrc\src\github.com\therecipe\qt\widgets\qtooltip.go:33:49: warning: unused variable 'a' [-Wunused-variable]
}
^

github.com/therecipe/qt/widgets

d:\gosrc\src\github.com\therecipe\qt\widgets\qwhatsthis.go: In function '_cgo_b12e6e04c547_Cfunc_QWhatsThis_QWhatsThis_EnterWhatsThisMode':
d:\gosrc\src\github.com\therecipe\qt\widgets\qwhatsthis.go:46:49: warning: unused variable 'a' [-Wunused-variable]

                                             ^

d:\gosrc\src\github.com\therecipe\qt\widgets\qwhatsthis.go: In function '_cgo_b12e6e04c547_Cfunc_QWhatsThis_QWhatsThis_HideText':
d:\gosrc\src\github.com\therecipe\qt\widgets\qwhatsthis.go:55:49: warning: unused variable 'a' [-Wunused-variable]

                                             ^

d:\gosrc\src\github.com\therecipe\qt\widgets\qwhatsthis.go: In function '_cgo_b12e6e04c547_Cfunc_QWhatsThis_QWhatsThis_LeaveWhatsThisMode':
d:\gosrc\src\github.com\therecipe\qt\widgets\qwhatsthis.go:76:49: warning: unused variable 'a' [-Wunused-variable]

                                             ^

github.com/therecipe/qt/widgets

d:\gosrc\src\github.com\therecipe\qt\widgets\widgets.cpp:3654:51: warning: multi-character character constant [-Wmultichar]
QList aList = QByteArray(argv).split(',,,');
^
d:\gosrc\src\github.com\therecipe\qt\widgets\widgets.cpp: In function 'void* QApplication_NewQApplication(int, char_)':
d:\gosrc\src\github.com\therecipe\qt\widgets\widgets.cpp:3654:56: warning: overflow in implicit constant conversion [-Woverflow]
QList aList = QByteArray(argv).split(',,,');
^
d:\gosrc\src\github.com\therecipe\qt\widgets\widgets.cpp: At global scope:
d:\gosrc\src\github.com\therecipe\qt\widgets\widgets.cpp:19207:121: warning: unused parameter 'ok' [-Wunused-parameter]
int QInputDialog_QInputDialog_GetInt(void_ parent, char* title, char* label, int value, int min, int max, int step, int ok, int flags){
^
d:\gosrc\src\github.com\therecipe\qt\widgets\widgets.cpp:19211:125: warning: unused parameter 'ok' [-Wunused-parameter]
char* QInputDialog_QInputDialog_GetItem(void* parent, char* title, char* label, char* items, int current, int editable, int ok, int flags, int inputMethodHints){
^
d:\gosrc\src\github.com\therecipe\qt\widgets\widgets.cpp:19215:106: warning: unused parameter 'ok' [-Wunused-parameter]
char* QInputDialog_QInputDialog_GetMultiLineText(void* parent, char* title, char* label, char* text, int ok, int flags, int inputMethodHints){
^
d:\gosrc\src\github.com\therecipe\qt\widgets\widgets.cpp:19219:107: warning: unused parameter 'ok' [-Wunused-parameter]
char* QInputDialog_QInputDialog_GetText(void* parent, char* title, char* label, int mode, char* text, int ok, int flags, int inputMethodHints){
^

cc1plus.exe: out of memory allocating 876984 bytes

error:exit status 2

exit status 1

D:\gosrc\src\github.com\therecipe\qt>if 1 NEQ 0 exit /b 1

D:\gosrc\src\github.com\therecipe\qt>

Error Installing on Mac OS X 10.11

I have xCode and QT installed on my computer and when I try to go-get the package I get an error: stat ./internal/setup/check.go: no such file or directory. How can I fix this?

Event filters are not working

Event filters are not working (i am testing on linux x64), when i try it on a QPlainTextEdit control. I have tried different ways, but still not able to figure out how to get this done. I am new to GO, QT and ofcourse the bindings, so can't figure it out myself ( Too many new things i know at this time ).

when i use InstallEventFilter method, i get this as compile error.
widgets.QPlainTextEdit does not implement core.QObject_ITF (missing QObject_PTR method)

Also, i tried using various Connect methods for events such as ConnectEventFilter, ConnectKeyPressEvent, ConnectEvent but in all the case i was not able to catch any events. Also, no compile time/runtime error occurs.

btw, extremely good work, this seems to be a holy grail, because using the binding is easy rather than clumsy C.This might easily take the place of https://github.com/google/gxui, if more documentation, examples are provided.

How to extend QObject to implement signals and slots

Thank you very much for making such an amazing library.
I ran into a problem today. I want to subclass a QObject to add some signals and slots and then pass the pointer to QmlEngine so I can call go functions from QML. This can be done easily in c++ , but how to do this with golang?

Raspberry PI 2/3 (ARM 7) libraries

Dear Sir,

Do you think is possible to provide us with .a libraries for the ARM processor?
Do you have any methodology how it could be done that?

Many thanks in advance for your answer
Dimitris

QGraphicsPathItem

Hi,

I made this example as a base test of QGraphicsPathItem. I am using something like it right now that works but for some reason this example does not work. (edit: modified and still doesn't work..)

I wanted to test QGraphicsPathItem separately. I have added QGraphicsPathItem by using Scene AddItem but could not get RemoveItem to work.

    package main

    import (
        "os"

        "github.com/therecipe/qt/core"
        "github.com/therecipe/qt/gui"
        "github.com/therecipe/qt/widgets"
    )

    var (
        canvas *widgets.QWidget
        scene  *widgets.QGraphicsScene
        view   *widgets.QGraphicsView
    )

    type line struct{ *widgets.QGraphicsPathItem }

    func main() {
        widgets.NewQApplication(len(os.Args), os.Args)

        NewCanvas().Show()

        widgets.QApplication_Exec()
    }

    func NewCanvas() *widgets.QWidget {
        canvas = widgets.NewQWidget(nil, 0)
        scene = widgets.NewQGraphicsScene(nil)
        view = widgets.NewQGraphicsView(nil)

        var l = &line{QGraphicsPathItem: widgets.NewQGraphicsPathItem(nil)}
        l.ConnectBoundingRect(l.boundingRect)
        l.ConnectPaint(l.paint)

        scene.AddItem(l)

        view.SetScene(scene)

        var layout = widgets.NewQVBoxLayout()
        layout.AddWidget(view, 0, 0)

        canvas.SetLayout(layout)

        return canvas
    }

    func (l *line) paint(p *gui.QPainter, o *widgets.QStyleOptionGraphicsItem, w *widgets.QWidget) {
        var color = gui.NewQColor3(0, 0, 0, 255)
        var brush = gui.NewQBrush3(color, 0) // solid = 1, nobrush = 0
        var pen = gui.NewQPen3(color)
        pen.SetWidth(1)

        p.SetRenderHint(1, true) // Antiailiasing
        p.SetPen(pen)
        p.SetBrush(brush)

        path := gui.NewQPainterPath()

        sx, sy, tx, ty := 0.0, 0.0, scene.Width(), scene.Height()/2

        path.MoveTo2(sx, sy)
        path.LineTo2(tx, ty)
        p.DrawPath(path)
    }

    func (l *line) boundingRect() *core.QRectF {
        return core.NewQRectF4(0.0, 0.0, scene.Width(), scene.Height()/2)
    }

Can not work with gocode

var window = widgets.NewQMainWindow(nil, 0)
window.

When I type '.', it will be block a long time, without any prompt

my platform:
win10x64
qt-opensource-windows-x86-mingw530-5.7.0.exe
golang 1.7.1 amd64

please help to make working qml application

I copy qml example from https://github.com/therecipe/qt/tree/master/internal/examples/qml/application
to d:\gosrc\src\qtQml (gopath d:\gosrc\src)

d:\gosrc\src\qtQml>dir

Том в устройстве D имеет метку Black
Серийный номер тома: EE89-CC7D

Содержимое папки d:\gosrc\src\qtQml

11.08.2016 16:20

.
11.08.2016 16:20 ..
11.08.2016 15:23 343 application.go
11.08.2016 15:24 qml
1 файлов 343 байт
4 папок 609 981 190 144 байт свободно

run d:\gosrc\src>qtdeploy build desktop qtQml

d:\gosrc\src\qtQml\deploy\windows>dir

Том в устройстве D имеет метку Black
Серийный номер тома: EE89-CC7D

Содержимое папки d:\gosrc\src\qtQml\deploy\windows

11.08.2016 16:20

.
11.08.2016 16:20 ..
11.08.2016 16:20 bearer
01.07.2016 06:23 3 695 104 D3Dcompiler_47.dll
11.08.2016 16:20 iconengines
11.08.2016 16:20 imageformats
10.06.2016 10:16 22 016 libEGL.dll
29.12.2015 01:25 120 334 libgcc_s_dw2-1.dll
10.06.2016 10:16 2 801 664 libGLESV2.dll
29.12.2015 01:25 1 540 622 libstdc++-6.dll
29.12.2015 01:25 79 360 libwinpthread-1.dll
23.09.2014 13:36 15 220 736 opengl32sw.dll
11.08.2016 16:20 platforms
11.08.2016 16:20 private
11.08.2016 16:20 qmltooling
11.08.2016 16:20 5 384 704 Qt5Core.dll
10.06.2016 10:23 5 283 840 Qt5Gui.dll
10.06.2016 10:17 1 610 240 Qt5Network.dll
11.06.2016 15:22 3 924 480 Qt5Qml.dll
11.06.2016 15:35 3 771 904 Qt5Quick.dll
10.06.2016 20:51 348 160 Qt5Svg.dll
10.06.2016 10:29 6 358 528 Qt5Widgets.dll
11.08.2016 16:20 QtGraphicalEffects
11.08.2016 16:20 QtQml
11.08.2016 16:20 19 206 656 qtQml.exe
11.08.2016 16:20 QtQuick
11.08.2016 16:20 QtQuick.2
11.08.2016 16:20 translations
15 файлов 69 368 348 байт
13 папок 609 981 190 144 байт свободно

try to run qtQml.exe and get a blank screen, no error messages

QGraphicsScene

Hi,

Adding text works but as soon as I add a line or rectangle, the source compiles but the executable doesn't run. Commenting out color, pen and addline2 produces a working file.

package gfx

import (
    "github.com/therecipe/qt/gui"
    "github.com/therecipe/qt/widgets"
)

var (
    canvas *widgets.QWidget
    scene  *widgets.QGraphicsScene
    view   *widgets.QGraphicsView
)

func NewCanvas() *widgets.QWidget {
    canvas = widgets.NewQWidget(nil, 0)
    scene = widgets.NewQGraphicsScene(nil)
    view = widgets.NewQGraphicsView(nil)

    font := gui.NewQFont2("Meiryo", 20, 2, false)
    scene.AddText("Hello 世界", font)

    var color = gui.NewQColor2(255, 0, 0, 1)
    var pen = gui.NewQPen3(color)

    scene.AddLine2(20, 20, 20, 20, pen)

    view.SetScene(scene)

    var layout = widgets.NewQVBoxLayout()
    layout.AddWidget(view, 0, 0)

    canvas.SetLayout(layout)

    return canvas

}

Error running setup.bat [Fixed/Never mind]

For future reference, seeing as I can't delete this, in case someone else runs into the same/similar issues..

First issue was with an "out of memory" error during the widgets part of the "install" routine. Fixed by reinstalling Go (I had the same version, but it was custom built so probably something about the compile limiting memory usage or something I'd guess)

Second error I got was "bad reloc address 0x4 in section `.data'" during install routine for uitools. The cause was that it referenced/used my local mingw install and not the one I installed as part Qt.

Qt 5.6 support ?

Hi, great project ! But it seems only working under Qt 5.5.1. And this morning i tried for replacing all "5.5.1" with "5.6.0", I know it's a foolish move, i got a lot of path not found error.

So any chance to support Qt5.6? or add an option to choose the qt version?

graph editor

https://github.com/5k3105/AM

I uploaded the graph editor I've been working on. It's very incomplete but I need to stop here because the screen updates just don't work.

Left click on screen to plot rectangle

If you have two rectangles you can click on one and click on the other and it will draw a connecting line.

Right click to delete rectangle. This should also delete the lines connected to it.

Left clicking the top right of rectangle switches into Move mode. Clicking again will drop the rectangle where you moved it to.

All this appears to work.

However if you play around you can see:

Sometimes the line to draw the connections will stay on the screen even though there's already been a RemoveItem call.

If you move the rectangle and drop it then right click to remove, the node will disappear from the list on the left panel but the image will persist on the screen. So will it's edges. And if it's connected to another rectangle and you move that rectangle, the edge will follow as if it hasn't been deleted but it has.

I will try to strip this project down to the bare minimum so as to be a good example program for others but at the moment the scene updates don't work right.

QInputDialog_GetText crashes randomly

Original define is

QString QInputDialog::getText(QWidget * parent, const QString & title, const QString & label, QLineEdit::EchoMode mode = QLineEdit::Normal, const QString & text = QString(), bool * ok = 0, Qt::WindowFlags flags = 0, Qt::InputMethodHints inputMethodHints = Qt::ImhNone)

your definition is

func QInputDialog_GetText(parent QWidget_ITF, title string, label string, mode QLineEdit__EchoMode, text string, ok bool, flags core.Qt__WindowType, inputMethodHints core.Qt__InputMethodHint) string {
    defer qt.Recovering("QInputDialog::getText")

    return C.GoString(C.QInputDialog_QInputDialog_GetText(PointerFromQWidget(parent), C.CString(title), C.CString(label), C.int(mode), C.CString(text), C.int(qt.GoBoolToInt(ok)), C.int(flags), C.int(inputMethodHints)))
}

if you see carefully, the ok bool parameter is a pointer, which causes the application to crash randomly.similiar bug appear in various other forms of QInputDialog.

libQt5Core.so: error: undefined reference to '__page_size'

Cannot install for android:

  • android-ndk r12
  • android-platform 23_r03
  • android-sdk 25.1.7
  • android-sdk-build-tools r24
./setup.sh android
------------------------install-------------------------
core

install.Core_1
output:# github.com/therecipe/qt/core
/tmp/go-build838252852/github.com/therecipe/qt/core/_obj/_cgo_main.c: In function 'crosscall2':
/tmp/go-build838252852/github.com/therecipe/qt/core/_obj/_cgo_main.c:2:23: warning: unused parameter 'fn' [-Wunused-parameter]
 void crosscall2(void(*fn)(void*, int), void *a, int c) { }
                       ^
/tmp/go-build838252852/github.com/therecipe/qt/core/_obj/_cgo_main.c:2:46: warning: unused parameter 'a' [-Wunused-parameter]
 void crosscall2(void(*fn)(void*, int), void *a, int c) { }
                                              ^
/tmp/go-build838252852/github.com/therecipe/qt/core/_obj/_cgo_main.c:2:53: warning: unused parameter 'c' [-Wunused-parameter]
 void crosscall2(void(*fn)(void*, int), void *a, int c) { }
                                                     ^
/tmp/go-build838252852/github.com/therecipe/qt/core/_obj/_cgo_main.c: In function '_cgo_allocate':
/tmp/go-build838252852/github.com/therecipe/qt/core/_obj/_cgo_main.c:5:26: warning: unused parameter 'a' [-Wunused-parameter]
 void _cgo_allocate(void *a, int c) { }
                          ^
/tmp/go-build838252852/github.com/therecipe/qt/core/_obj/_cgo_main.c:5:33: warning: unused parameter 'c' [-Wunused-parameter]
 void _cgo_allocate(void *a, int c) { }
                                 ^
/tmp/go-build838252852/github.com/therecipe/qt/core/_obj/_cgo_main.c: In function '_cgo_panic':
/tmp/go-build838252852/github.com/therecipe/qt/core/_obj/_cgo_main.c:6:23: warning: unused parameter 'a' [-Wunused-parameter]
 void _cgo_panic(void *a, int c) { }
                       ^
/tmp/go-build838252852/github.com/therecipe/qt/core/_obj/_cgo_main.c:6:30: warning: unused parameter 'c' [-Wunused-parameter]
 void _cgo_panic(void *a, int c) { }
                              ^
# github.com/therecipe/qt/core
core/core.go: In function '_cgo_2847a0265156_Cfunc_QCoreApplication_QCoreApplication_Flush':
core/core.go:10154:33: warning: unused variable 'a' [-Wunused-variable]

                                 ^
core/core.go: In function '_cgo_2847a0265156_Cfunc_QThread_QThread_YieldCurrentThread':
core/core.go:46726:33: warning: unused variable 'a' [-Wunused-variable]
 func (ptr *QPropertyAnimation) UpdateDirectionDefault(direction QAbstractAnimation__Direction) {
                                 ^
# github.com/therecipe/qt/core
core/core.cpp:566:58: warning: unused parameter 'ptr' [-Wunused-parameter]
 int QAbstractEventDispatcher_RegisterEventNotifier(void* ptr, void* notifier)
                                                          ^
core/core.cpp:566:69: warning: unused parameter 'notifier' [-Wunused-parameter]
 int QAbstractEventDispatcher_RegisterEventNotifier(void* ptr, void* notifier)
                                                                     ^
core/core.cpp:600:61: warning: unused parameter 'ptr' [-Wunused-parameter]
 void QAbstractEventDispatcher_UnregisterEventNotifier(void* ptr, void* notifier)
                                                             ^
core/core.cpp:600:72: warning: unused parameter 'notifier' [-Wunused-parameter]
 void QAbstractEventDispatcher_UnregisterEventNotifier(void* ptr, void* notifier)
                                                                        ^
core/core.cpp:10662:43: warning: unused parameter 'ok' [-Wunused-parameter]
 int QLocale_ToInt(void* ptr, char* s, int ok)
                                           ^
core/core.cpp:10667:44: warning: unused parameter 'ok' [-Wunused-parameter]
 int QLocale_ToInt2(void* ptr, void* s, int ok)
                                            ^
core/core.cpp:11107:52: warning: unused parameter 'ok' [-Wunused-parameter]
 int QMetaEnum_KeyToValue(void* ptr, char* key, int ok)
                                                    ^
core/core.cpp:11112:54: warning: unused parameter 'ok' [-Wunused-parameter]
 int QMetaEnum_KeysToValue(void* ptr, char* keys, int ok)
                                                      ^
core/core.cpp:18600:39: warning: unused parameter 'ok' [-Wunused-parameter]
 long QStringRef_ToLong(void* ptr, int ok, int base)
                                       ^
core/core.cpp:18850:37: warning: unused parameter 'ok' [-Wunused-parameter]
 int QStringRef_ToInt(void* ptr, int ok, int base)
                                     ^
core/core.cpp:22211:35: warning: unused parameter 'ok' [-Wunused-parameter]
 int QVariant_ToInt(void* ptr, int ok)
                                   ^
core/core.cpp:22246:39: warning: unused parameter 'ok' [-Wunused-parameter]
 double QVariant_ToReal(void* ptr, int ok)
                                       ^
# github.com/therecipe/qt/core
/usr/local/Qt5.7.0/5.7/android_armv7/lib/libQt5Core.so: error: undefined reference to '__page_size'
collect2: error: ld returned 1 exit status

error:exit status 2

exit status 1

Can not location program entrance point __gxx_personality_v0

I run this example:
therecipe\qt\internal\examples\widgets

And then run the exe file
therecipe\qt\internal\examples\widgets\deploy\windows\widgets.exe

Error Msg:
"Can not location program entrance point __gxx_personality_v0 ........... Qt5Core.dll"

Environment:
Windows 10 x64

Memory Leak (Windows)

Hi,

Using Win7 64-bit. Check out Line Edits example. Just cursoring over application window, application memory keeps increasing.

This didn't happen on the video player example.

I noticed this in my graph app.

Thanks

QTableView & QAbstractItemModel

Hi,

My code looks like this:

package main

import (
    "os"

    "github.com/therecipe/qt/widgets"
)

func main() {
    widgets.NewQApplication(len(os.Args), os.Args)

    // Main Window
    var window = widgets.NewQMainWindow(nil, 0)
    window.SetWindowTitle("Table")

    // Main Widget
    var table = NewArgsTable()

    // Set Central Widget
    window.SetCentralWidget(table)

    // Run App
    widgets.QApplication_SetStyle2("fusion")
    window.ShowMaximized()
    widgets.QApplication_Exec()
}
package main

import (
    "strconv"

    "github.com/emirpasic/gods/maps/treemap"
    "github.com/therecipe/qt/core"
    "github.com/therecipe/qt/widgets"
)

var (
    vl    *treemap.Map
    model *core.QAbstractItemModel
    view  *widgets.QTableView
)

func NewArgsTable() *widgets.QTableView {
    view = widgets.NewQTableView(nil)
    model = core.NewQAbstractItemModel(nil)

    model.ConnectRowCount(rowcount)
    model.ConnectColumnCount(columncount)
    model.ConnectData(data)
    model.ConnectSetData(setdata)
    model.ConnectInsertRows(insertrows)
    //model.ConnectFlags(flags)
    //model.ConnectRemoveRows(removerows)

    model.InsertRows(0, 5, core.NewQModelIndex()) // model.Parent(?)

    vl = treemap.NewWithIntComparator()

    for i := 0; i < 6; i++ {
        // set data in model
        var index = model.Index(i, 0, core.NewQModelIndex())
        model.SetData(index, core.NewQVariant14(strconv.Itoa(i+1)), 2) // edit role = 2
        // set data in dataset
        vl.Put(i, i)
    }

    view.SetModel(model)

    return view

}

func rowcount(parent *core.QModelIndex) int {
    return vl.Size()
}

func columncount(parent *core.QModelIndex) int {
    return 1
}

func data(index *core.QModelIndex, role int) *core.QVariant { // dataset to model/view
    if role == 0 && index.IsValid() { // display role = 0
        text, _ := vl.Get(index.Row())
        return core.NewQVariant14(text.(string))
    }
    return core.NewQVariant()
}

func setdata(index *core.QModelIndex, value *core.QVariant, role int) bool { // model/view to dataset
    if role == 2 && index.IsValid() {
        vl.Put(index.Row(), value.ToString())
        // The dataChanged() signal should be emitted if the data was successfully set.
        model.DataChanged() // signal
        return true
    }
    return true
}

func insertrows(row int, count int, parent *core.QModelIndex) bool {

    model.BeginInsertRows(core.NewQModelIndex(), count, count+row-1)
    for r := 0; r < row; r++ {
        // view.InsertRow() ?
    }
    model.EndInsertRows()

    return true
}

//func removerows(row int, count int, parent *core.QModelIndex) bool {}

//func flags(index *core.QModelIndex) core.Qt__ItemFlag {}

Error during the execution of setup.bat

During the execution of setup.bat with administrator account I come across to this message

setup

During the generate-phase says that "can't load package: .../therecipe/qt/core
nobuildable Go Source files in c:\prog\gopath\src\github.com\the recipe\qt\core.

  1. Before TheRecipe you changed the source code to use the GOROOT env variable (thanks for that) i was managed to build the code but, it couldnt see to be able to link the core.a library.

I do not know if there is any implication by using the administrator account during the creation of .a files, a file takes elevated privileges.

Thank you in advance.

P.S. A GO/QT executable, using 2 only widgets weighs a lot in MB?

Error: Can't compile on windows

Win7 32bit will crash when compiling. Here is the log info:

C:\develop\src\github.com\therecipe\qt>go run C:\develop/src/github.com/therecip
e/qt/internal/setup/install.go
Install-desktop
core 47s
androidextras 0
gui 47s
network 15s
sql 8s
xml 8s
dbus 6s
nfc 4s
script 5s
sensors 10s
positioning 5s
widgets

install.Widgets
output:# github.com/therecipe/qt/widgets
C:\Windows\go-build958700558\github.com\therecipe\qt\widgets_obj_cgo_main.c: I
n function 'crosscall2':
C:\Windows\go-build958700558\github.com\therecipe\qt\widgets_obj_cgo_main.c:2:
23: warning: unused parameter 'fn' [-Wunused-parameter]
void crosscall2(void(fn)(void, int), void _a, int c) { }
^
C:\Windows\go-build958700558\github.com\therecipe\qt\widgets_obj_cgo_main.c:2:
46: warning: unused parameter 'a' [-Wunused-parameter]
void crosscall2(void(fn)(void, int), void a, int c) { }
^
C:\Windows\go-build958700558\github.com\therecipe\qt\widgets_obj_cgo_main.c:2:
53: warning: unused parameter 'c' [-Wunused-parameter]
void crosscall2(void(_fn)(void
, int), void *a, int c) { }
^
C:\Windows\go-build958700558\github.com\therecipe\qt\widgets_obj_cgo_main.c: I
n function '_cgo_allocate':
C:\Windows\go-build958700558\github.com\therecipe\qt\widgets_obj_cgo_main.c:5:
26: warning: unused parameter 'a' [-Wunused-parameter]
void _cgo_allocate(void *a, int c) { }
^
C:\Windows\go-build958700558\github.com\therecipe\qt\widgets_obj_cgo_main.c:5:
33: warning: unused parameter 'c' [-Wunused-parameter]
void _cgo_allocate(void *a, int c) { }
^
C:\Windows\go-build958700558\github.com\therecipe\qt\widgets_obj_cgo_main.c: I
n function '_cgo_panic':
C:\Windows\go-build958700558\github.com\therecipe\qt\widgets_obj_cgo_main.c:6:
23: warning: unused parameter 'a' [-Wunused-parameter]
void _cgo_panic(void *a, int c) { }
^
C:\Windows\go-build958700558\github.com\therecipe\qt\widgets_obj_cgo_main.c:6:
30: warning: unused parameter 'c' [-Wunused-parameter]
void _cgo_panic(void *a, int c) { }
^

github.com/therecipe/qt/widgets

widgets\widgets.go: In function '_cgo_60ca106ee6b5_Cfunc_QApplication_QApplicati
on_AboutQt':
widgets\widgets.go:8110:49: warning: unused variable 'a' [-Wunused-variable]
}
^
widgets\widgets.go: In function '_cgo_60ca106ee6b5_Cfunc_QApplication_QApplicati
on_Beep':
widgets\widgets.go:8165:49: warning: unused variable 'a' [-Wunused-variable]
}
^
widgets\widgets.go: In function '_cgo_60ca106ee6b5_Cfunc_QApplication_QApplicati
on_CloseAllWindows':
widgets\widgets.go:8174:49: warning: unused variable 'a' [-Wunused-variable]
}
^
widgets\widgets.go: In function '_cgo_60ca106ee6b5_Cfunc_QScrollerProperties_QSc
rollerProperties_UnsetDefaultScrollerProperties':
widgets\widgets.go:74370:49: warning: unused variable 'a' [-Wunused-variable]
}
^
widgets\widgets.go: In function '_cgo_60ca106ee6b5_Cfunc_QToolTip_QToolTip_HideT
ext':
widgets\widgets.go:101481:49: warning: unused variable 'a' [-Wunused-variable]
}
^
widgets\widgets.go: In function '_cgo_60ca106ee6b5_Cfunc_QWhatsThis_QWhatsThis_E
nterWhatsThisMode':
widgets\widgets.go:108496:49: warning: unused variable 'a' [-Wunused-variable]
defer qt.Recovering("callback QPlainTextEdit::scrollContentsBy")
^
widgets\widgets.go: In function '_cgo_60ca106ee6b5_Cfunc_QWhatsThis_QWhatsThis_H
ideText':
widgets\widgets.go:108505:49: warning: unused variable 'a' [-Wunused-variable]
func (ptr *QPlainTextEdit) ScrollContentsBy(dx int, dy int) {
^
widgets\widgets.go: In function '_cgo_60ca106ee6b5_Cfunc_QWhatsThis_QWhatsThis_L
eaveWhatsThisMode':
widgets\widgets.go:108526:49: warning: unused variable 'a' [-Wunused-variable]
}
^

github.com/therecipe/qt/widgets

widgets\widgets.cpp:12702:44: warning: unused parameter 'ok' [-Wunused-parameter
]
void* QFontDialog_QFontDialog_GetFont2(int ok, void* parent){
^
widgets\widgets.cpp:12706:43: warning: unused parameter 'ok' [-Wunused-parameter
]
void* QFontDialog_QFontDialog_GetFont(int ok, void* initial, void* parent, char

  • title, int options){
    ^
    widgets\widgets.cpp:19515:121: warning: unused parameter 'ok' [-Wunused-paramete
    r]
    int QInputDialog_QInputDialog_GetInt(void* parent, char* title, char* label, in
    t value, int min, int max, int step, int ok, int flags){

                                     ^
    

    widgets\widgets.cpp:19519:125: warning: unused parameter 'ok' [-Wunused-paramete
    r]
    char* QInputDialog_QInputDialog_GetItem(void* parent, char* title, char* label,
    char* items, int current, int editable, int ok, int flags, int inputMethodHints
    ){

                                         ^
    

    widgets\widgets.cpp:19523:106: warning: unused parameter 'ok' [-Wunused-paramete
    r]
    char* QInputDialog_QInputDialog_GetMultiLineText(void* parent, char* title, cha
    r* label, char* text, int ok, int flags, int inputMethodHints){

                      ^
    

    widgets\widgets.cpp:19527:107: warning: unused parameter 'ok' [-Wunused-paramete
    r]
    char* QInputDialog_QInputDialog_GetText(void* parent, char* title, char* label,
    int mode, char* text, int ok, int flags, int inputMethodHints){

                         ^
    

    github.com/therecipe/qt/widgets

    fatal error: out of memory

runtime stack:
runtime.throw(0x7b4a40, 0xd)
c:/go/src/runtime/panic.go:530 +0x7f
runtime.(*mcache).refill(0x110250, 0xf, 0x72e906c0)
c:/go/src/runtime/mcache.go:121 +0xce
runtime.mallocgc.func2()
c:/go/src/runtime/malloc.go:642 +0x2b
runtime.systemstack(0x10f8c000)
c:/go/src/runtime/asm_386.s:313 +0x5e
runtime.mstart()
c:/go/src/runtime/proc.go:1048

goroutine 1 [running]:
runtime.systemstack_switch()
c:/go/src/runtime/asm_386.s:267 fp=0x506b57a4 sp=0x506b57a0
runtime.mallocgc(0xe0, 0x787e80, 0x1, 0x72b0fea0)
c:/go/src/runtime/malloc.go:643 +0x6ca fp=0x506b5810 sp=0x506b57a4
runtime.newobject(0x787e80, 0x72b0fea0)
c:/go/src/runtime/malloc.go:781 +0x41 fp=0x506b5824 sp=0x506b5810
cmd/compile/internal/gc.regopt.func1(0x0, 0x0)
c:/go/src/cmd/compile/internal/gc/reg.go:1064 +0x2b fp=0x506b5830 sp=0x5
06b5824
cmd/compile/internal/gc.Flowstart(0x72ae16c0, 0x8107f0, 0x10)
c:/go/src/cmd/compile/internal/gc/popt.go:288 +0x704 fp=0x506b58c0 sp=0x
506b5830
cmd/compile/internal/gc.regopt(0x72ae16c0)
c:/go/src/cmd/compile/internal/gc/reg.go:1064 +0x49f fp=0x506b5bb4 sp=0x
506b58c0
cmd/compile/internal/gc.compile(0x1a009500)
c:/go/src/cmd/compile/internal/gc/pgen.go:521 +0xc94 fp=0x506b5cf0 sp=0x
506b5bb4
cmd/compile/internal/gc.funccompile(0x1a009500)
c:/go/src/cmd/compile/internal/gc/dcl.go:1450 +0x198 fp=0x506b5d2c sp=0x
506b5cf0
cmd/compile/internal/gc.Main()
c:/go/src/cmd/compile/internal/gc/lex.go:472 +0x1c00 fp=0x506b5ec0 sp=0x
506b5d2c
cmd/compile/internal/x86.Main()
c:/go/src/cmd/compile/internal/x86/galign.go:108 +0x53e fp=0x506b5f2c sp
=0x506b5ec0
main.main()
c:/go/src/cmd/compile/main.go:30 +0x117 fp=0x506b5f98 sp=0x506b5f2c
runtime.main()
c:/go/src/runtime/proc.go:188 +0x234 fp=0x506b5fc0 sp=0x506b5f98
runtime.goexit()
c:/go/src/runtime/asm_386.s:1585 +0x1 fp=0x506b5fc4 sp=0x506b5fc0

error:exit status 2

exit status 1

C:\develop\src\github.com\therecipe\qt>if 1 NEQ 0 exit /b 1

Connect Event parameters

Am I doing this right?:

var list = widgets.NewQListWidget(nil)
list.ConnectKeyPressEvent(func(event *gui.QKeyEvent) { keyPressEvent(event) })

...

func keyPressEvent(event *gui.QKeyEvent) { ... }

QTableView / QTableWidget

Hello,

Do you have plans to implement these?

Currently NewQTableViewFromPointer / NewQTableWidgetFromPointer exist.

Also, gui.NewQPixmap?

Thanks.

QWindow.FromWinId ?

Will 'FromWinId' be supported? (http://doc.qt.io/qt-5/qwindow.html#fromWinId)

    var hw win.HWND
    ...
    hw = win.FindWindow(nil, syscall.StringToUTF16Ptr(windowName))

    widgets.NewQApplication(len(os.Args), os.Args)

    var window = widgets.NewQMainWindow(nil, 0)

    w := gui.NewQWindow(nil)
    w.FromWinId(hw)
    x := widgets.CreateWindowContainer(w, nil, 0)

    window.SetCentralWidget(x)
    window.ShowMaximized()
    widgets.QApplication_Exec()

QWebEngineView

Hi tr :)

I saw you implemented webengine and gave it a try :)

package main

import (
    "github.com/therecipe/qt/core"
    "github.com/therecipe/qt/webengine"
    "github.com/therecipe/qt/widgets"
)

func main() {
    widgets.NewQApplication(len(os.Args), os.Args)

    // Main Window
    var window = widgets.NewQMainWindow(nil, 0)
    window.SetWindowTitle("Browser")

    // Main Widget
    view := widgets.NewQWebEngineView(window)

    // Set Central Widget
    window.SetCentralWidget(view)

    var url = core.NewQUrl("http://doc.qt.io/qt-5/qurl.html", 0)
    view.Load(url)
    view.Show()

    // Run App
    widgets.QApplication_SetStyle2("fusion")
    window.ShowMaximized()
    widgets.QApplication_Exec()
}
build_1                                                                                                                      
output:# github.com/therecipe/qt/webengine                                                                                   
C:\windows\go-build081060382\github.com\therecipe\qt\webengine\_obj\_cgo_main.c: In function 'crosscall2':                   
C:\windows\go-build081060382\github.com\therecipe\qt\webengine\_obj\_cgo_main.c:2:23: warning: unused parameter 'fn' [-Wunuse
d-parameter]                                                                                                                 
 void crosscall2(void(*fn)(void*, int), void *a, int c) { }                                                                  
                       ^                                                                                                     
C:\windows\go-build081060382\github.com\therecipe\qt\webengine\_obj\_cgo_main.c:2:46: warning: unused parameter 'a' [-Wunused
-parameter]                                                                                                                  
 void crosscall2(void(*fn)(void*, int), void *a, int c) { }                                                                  
                                              ^                                                                              
C:\windows\go-build081060382\github.com\therecipe\qt\webengine\_obj\_cgo_main.c:2:53: warning: unused parameter 'c' [-Wunused
-parameter]                                                                                                                  
 void crosscall2(void(*fn)(void*, int), void *a, int c) { }                                                                  
                                                     ^                                                                       
C:\windows\go-build081060382\github.com\therecipe\qt\webengine\_obj\_cgo_main.c: In function '_cgo_allocate':                
C:\windows\go-build081060382\github.com\therecipe\qt\webengine\_obj\_cgo_main.c:5:26: warning: unused parameter 'a' [-Wunused
-parameter]                                                                                                                  
 void _cgo_allocate(void *a, int c) { }                                                                                      
                          ^                                                                                                  
C:\windows\go-build081060382\github.com\therecipe\qt\webengine\_obj\_cgo_main.c:5:33: warning: unused parameter 'c' [-Wunused
-parameter]                                                                                                                  
 void _cgo_allocate(void *a, int c) { }                                                                                      
                                 ^                                                                                           
C:\windows\go-build081060382\github.com\therecipe\qt\webengine\_obj\_cgo_main.c: In function '_cgo_panic':                   
C:\windows\go-build081060382\github.com\therecipe\qt\webengine\_obj\_cgo_main.c:6:23: warning: unused parameter 'a' [-Wunused
-parameter]                                                                                                                  
 void _cgo_panic(void *a, int c) { }                                                                                         
                       ^                                                                                                     
C:\windows\go-build081060382\github.com\therecipe\qt\webengine\_obj\_cgo_main.c:6:30: warning: unused parameter 'c' [-Wunused
-parameter]                                                                                                                  
 void _cgo_panic(void *a, int c) { }                                                                                         
                              ^                                                                                              
# github.com/therecipe/qt/webengine                                                                                          
..\..\github.com\therecipe\qt\webengine\webengine.cpp:42:34: fatal error: QQuickWebEngineProfile: No such file or directory  
compilation terminated.                                                                                                      

error:exit status 2                                                                                                          

ConnectCurrentItemChanged

Hi,

Using QListWidget:

func (ptr *QListWidget) ConnectCurrentItemChanged(f func(current *QListWidgetItem, previous *QListWidgetItem))
func (ptr *QListWidget) CurrentItemChanged(current QListWidgetItem_ITF, previous QListWidgetItem_ITF)

I get error:

λ qtdeploy


build_1
output:# local/AM/controlbox/graphpanel
controlbox\graphpanel\graphpanel.go:102: cannot use gp.NodeList.CurrentItemChanged (type func(widgets.QListWidgetItem_ITF, widgets.QListWidgetItem_ITF)) as type func(*widgets.QListWidgetItem, *widgets.QListWidgetItem) in argument to gp.NodeList.ConnectCurrentItemChanged

error:exit status 2

I've used both:

type Nodelist struct{ *widgets.QListWidget }

func (n *Nodelist) CurrentItemChanged(current widgets.QListWidgetItem_ITF, previous widgets.QListWidgetItem_ITF) {

}

func (n *Nodelist) CurrentItemChanged(current *widgets.QListWidgetItem, previous *widgets.QListWidgetItem) {

}

error in running setup batch file on win7

When I run setup.bat on win7 I get generate message then:

file.Save open C:\Go\bin;C:\Go\src\github.com\therecipe\qt\dbus\cgo_android_arm. go: The filename, directory name, or volume label syntax is incorrect. file.Save open C:\Go\bin;C:\Go\src\github.com\therecipe\qt\dbus\qdbusobjectpath. h: The filename, directory name, or volume label syntax is incorrect. file.MakeFolder mkdir C:\Go\bin;C:: The filename, directory name, or volume labe l syntax is incorrect. file.Save open C:\Go\bin;C:\Go\src\github.com\therecipe\qt\dbus\cgo_darwin_amd64 .go: The filename, directory name, or volume label syntax is incorrect. file.Save open C:\Go\bin;C:\Go\src\github.com\therecipe\qt\dbus\cgo_windows_386. go: The filename, directory name, or volume label syntax is incorrect. file.Save open C:\Go\bin;C:\Go\src\github.com\therecipe\qt\dbus\cgo_linux_386.go : The filename, directory name, or volume label syntax is incorrect.

and keeps repeating. I shut the console down. I then go to therecipe/qt directory (using cmder console app), list the dir and I get:

The file will have its original line endings in your working directory. warning: LF will be replaced by CRLF in xml/qdomnamednodemap.go. The file will have its original line endings in your working directory. warning: LF will be replaced by CRLF in xml/qdomnode.go. The file will have its original line endings in your working directory. warning: LF will be replaced by CRLF in xml/qdomnodelist.go. The file will have its original line endings in your working directory. warning: LF will be replaced by CRLF in xml/qdomnotation.go. The file will have its original line endings in your working directory. warning: LF will be replaced by CRLF in xml/qdomprocessinginstruction.go. The file will have its original line endings in your working directory. warning: LF will be replaced by CRLF in xml/qdomtext.go. The file will have its original line endings in your working directory. warning: LF will be replaced by CRLF in xml/qxmlattributes.go. The file will have its original line endings in your working directory. warning: LF will be replaced by CRLF in xml/qxmlcontenthandler.go. The file will have its original line endings in your working directory. warning: LF will be replaced by CRLF in xml/qxmldeclhandler.go. The file will have its original line endings in your working directory. warning: LF will be replaced by CRLF in xml/qxmldefaulthandler.go. The file will have its original line endings in your working directory. warning: LF will be replaced by CRLF in xml/qxmldtdhandler.go. The file will have its original line endings in your working directory. warning: LF will be replaced by CRLF in xml/qxmlentityresolver.go. The file will have its original line endings in your working directory. warning: LF will be replaced by CRLF in xml/qxmlerrorhandler.go. The file will have its original line endings in your working directory. warning: LF will be replaced by CRLF in xml/qxmlinputsource.go. The file will have its original line endings in your working directory. warning: LF will be replaced by CRLF in xml/qxmllexicalhandler.go. The file will have its original line endings in your working directory. warning: LF will be replaced by CRLF in xml/qxmllocator.go. The file will have its original line endings in your working directory. warning: LF will be replaced by CRLF in xml/qxmlnamespacesupport.go. The file will have its original line endings in your working directory. warning: LF will be replaced by CRLF in xml/qxmlparseexception.go. The file will have its original line endings in your working directory. warning: LF will be replaced by CRLF in xml/qxmlreader.go. The file will have its original line endings in your working directory. warning: LF will be replaced by CRLF in xml/qxmlsimplereader.go. The file will have its original line endings in your working directory.

By only listing the directory!

Using windows to go to the directory or the cmd console prints the directory normally..

Btw thanks for your hard work attempting to get this ported over. This is very important work imo :)

Thank you! It works well.

Hi, therecipe. Thank you for this hard work.
I ran the example. And it works well without any error in my opensuse13.2!

QGrapicsItems Interactions

Hi,

I am wanting to hook into events for rectangle, ellipse and text but it looks like these are not completely implemented yet:

QGraphicsEllipseItem
QGraphicsLineItem
QGraphicsPathItem
QGraphicsPixmapItem
QGraphicsPolygonItem
QGraphicsRectItem
QGraphicsSimpleTextItem
QGraphicsTextItem

Thanks

GOROOT environment variable chcck during the execution of setup.bat

Really thank you for your wonderful effort.
Your guide is simple and understandable

Please during the execution of setup.bat (install_std_1 phase) I had the error
"output:go: cannot find GOROOT directory: c:\go"

My Go installation is not in C:\GO but is described from GOROOT
Can you change it generally to check GOROOT?

Thank you in advance

Android Setup - error: undefined reference to '__page_size'

Hi tr - this is just something I was testing out.

C:\goworksp\src\github.com\therecipe\qt (master)
λ setup.bat android

go get golang.org/x/crypto/ssh

if 0 NEQ 0 exit /b 0

go run ./internal/setup/check.go android

if 0 NEQ 0 exit /b 0

go run C:\goworksp/src/github.com/therecipe/qt/internal/setup/generate.go android

if 0 NEQ 0 exit /b 0

go run C:\goworksp/src/github.com/therecipe/qt/internal/setup/install.go android
------------------------install-------------------------
core

install.Core_1
output:# github.com/therecipe/qt/core
C:\windows\go-build785918078\github.com\therecipe\qt\core\_obj\_cgo_main.c: In function 'crosscall2':
C:\windows\go-build785918078\github.com\therecipe\qt\core\_obj\_cgo_main.c:2:23: warning: unused parameter 'fn' [-Wunused-parameter]
 void crosscall2(void(*fn)(void*, int), void *a, int c) { }
                       ^
C:\windows\go-build785918078\github.com\therecipe\qt\core\_obj\_cgo_main.c:2:46: warning: unused parameter 'a' [-Wunused-parameter]
 void crosscall2(void(*fn)(void*, int), void *a, int c) { }
                                              ^
C:\windows\go-build785918078\github.com\therecipe\qt\core\_obj\_cgo_main.c:2:53: warning: unused parameter 'c' [-Wunused-parameter]
 void crosscall2(void(*fn)(void*, int), void *a, int c) { }
                                                     ^
C:\windows\go-build785918078\github.com\therecipe\qt\core\_obj\_cgo_main.c: In function '_cgo_allocate':
C:\windows\go-build785918078\github.com\therecipe\qt\core\_obj\_cgo_main.c:5:26: warning: unused parameter 'a' [-Wunused-parameter]
 void _cgo_allocate(void *a, int c) { }
                          ^
C:\windows\go-build785918078\github.com\therecipe\qt\core\_obj\_cgo_main.c:5:33: warning: unused parameter 'c' [-Wunused-parameter]
 void _cgo_allocate(void *a, int c) { }
                                 ^
C:\windows\go-build785918078\github.com\therecipe\qt\core\_obj\_cgo_main.c: In function '_cgo_panic':
C:\windows\go-build785918078\github.com\therecipe\qt\core\_obj\_cgo_main.c:6:23: warning: unused parameter 'a' [-Wunused-parameter]
 void _cgo_panic(void *a, int c) { }
                       ^
C:\windows\go-build785918078\github.com\therecipe\qt\core\_obj\_cgo_main.c:6:30: warning: unused parameter 'c' [-Wunused-parameter]
 void _cgo_panic(void *a, int c) { }
                              ^
# github.com/therecipe/qt/core
core\core.go: In function '_cgo_f981539ad049_Cfunc_QCoreApplication_QCoreApplication_Flush':
core\core.go:10154:33: warning: unused variable 'a' [-Wunused-variable]

                                 ^
core\core.go: In function '_cgo_f981539ad049_Cfunc_QThread_QThread_YieldCurrentThread':
core\core.go:46726:33: warning: unused variable 'a' [-Wunused-variable]
 func (ptr *QPropertyAnimation) UpdateDirectionDefault(direction QAbstractAnimation__Direction) {
                                 ^
# github.com/therecipe/qt/core
core\core.cpp:566:58: warning: unused parameter 'ptr' [-Wunused-parameter]
 int QAbstractEventDispatcher_RegisterEventNotifier(void* ptr, void* notifier)
                                                          ^
core\core.cpp:566:69: warning: unused parameter 'notifier' [-Wunused-parameter]
 int QAbstractEventDispatcher_RegisterEventNotifier(void* ptr, void* notifier)
                                                                     ^
core\core.cpp:600:61: warning: unused parameter 'ptr' [-Wunused-parameter]
 void QAbstractEventDispatcher_UnregisterEventNotifier(void* ptr, void* notifier)
                                                             ^
core\core.cpp:600:72: warning: unused parameter 'notifier' [-Wunused-parameter]
 void QAbstractEventDispatcher_UnregisterEventNotifier(void* ptr, void* notifier)
                                                                        ^
core\core.cpp:10662:43: warning: unused parameter 'ok' [-Wunused-parameter]
 int QLocale_ToInt(void* ptr, char* s, int ok)
                                           ^
core\core.cpp:10667:44: warning: unused parameter 'ok' [-Wunused-parameter]
 int QLocale_ToInt2(void* ptr, void* s, int ok)
                                            ^
core\core.cpp:11107:52: warning: unused parameter 'ok' [-Wunused-parameter]
 int QMetaEnum_KeyToValue(void* ptr, char* key, int ok)
                                                    ^
core\core.cpp:11112:54: warning: unused parameter 'ok' [-Wunused-parameter]
 int QMetaEnum_KeysToValue(void* ptr, char* keys, int ok)
                                                      ^
core\core.cpp:18600:39: warning: unused parameter 'ok' [-Wunused-parameter]
 long QStringRef_ToLong(void* ptr, int ok, int base)
                                       ^
core\core.cpp:18850:37: warning: unused parameter 'ok' [-Wunused-parameter]
 int QStringRef_ToInt(void* ptr, int ok, int base)
                                     ^
core\core.cpp:22211:35: warning: unused parameter 'ok' [-Wunused-parameter]
 int QVariant_ToInt(void* ptr, int ok)
                                   ^
core\core.cpp:22246:39: warning: unused parameter 'ok' [-Wunused-parameter]
 double QVariant_ToReal(void* ptr, int ok)
                                       ^
# github.com/therecipe/qt/core
C:/Qt/Qt5.7.0/5.7/android_armv7/lib/libQt5Core.so: error: undefined reference to '__page_size'
collect2.exe: error: ld returned 1 exit status

error:exit status 2

exit status 1

if 1 NEQ 0 exit /b 1

C:\goworksp\src\github.com\therecipe\qt (master)

sorry to trouble you

I'm sorry to trouble you. I watch your course study. But when I had a problem, I couldn't solve it.
d:\gopath\src\github.com\therecipe\qt\core\core.cpp:4:30: fatal error: QAbstractAnimation: No such file or directory

compilation terminated

Refine

Do you plan on refine this library? Like qt.NewDialog instead of qt.NewQDialog_QWidget_WindowType and mirroring the Qt documentation.

setup.bat error

D:\go\gopath\src\github.com\therecipe\qt>go run ./internal/setup/check.go

error:
GOPATH IS GOROOT

exit status 1

C:\WINDOWS\System32>go env
set GOARCH=386
set GOBIN=D:\go\bin
set GOEXE=.exe
set GOHOSTARCH=386
set GOHOSTOS=windows
set GOOS=windows
set GOPATH=D:\go\gopath
set GORACE=
set GOROOT=D:\go
set GOTOOLDIR=D:\go\pkg\tool\windows_386
set GO15VENDOREXPERIMENT=
set CC=gcc
set GOGCCFLAGS=-m32 -mthreads -fmessage-length=0
set CXX=g++
set CGO_ENABLED=1

NewPackagename_

Hi,

The moc generates method names that I am using so I have to rename those. But it is also using camelcase NewPackagename for my struct creations - which is kind of aggravating because I'm not sure what I should rename all my struct creators. I began putting underscores at the end of the method names to distinguish them. Now I am putting underscores behind the struct creators. Is it possible to have your moc program use these alternate name + underscore instead so my code doesn't look so strange?

Thanks

package controlbox

type Controlbox struct {
    *widgets.QWidget
    Mode            string
    Tool            string
    }

func NewControlbox(canvas *widgets.QWidget, statusbar *widgets.QStatusBar) *Controlbox {

    cb := &Controlbox{}
    ... }
controlbox\moc.go:56: NewControlbox redeclared in this block
        previous declaration at controlbox\controlbox.go:22

drag & drop

Hi,

Trying drag and drop with QListWidget. When I attempt to drop the cursor shows circle and slash as if it can't accept drops. Also on the MimeData there doesn't seem to be a Urls() method.

Thanks

    gp.ValueList = Valuelist{widgets.NewQListWidget(nil)}

    gp.ValueList.SetAcceptDrops(true)

    vlayout.AddWidget(gp.ValueList, 0, 0)

    gp.ValueList.ConnectDragEnterEvent(gp.ValueList.DragEnterEvent)
    gp.ValueList.ConnectDropEvent(gp.ValueList.DropEvent)
    import (
        "github.com/therecipe/qt/core"
        "github.com/therecipe/qt/gui"
        "github.com/therecipe/qt/widgets"
    )

    type Valuelist struct{ *widgets.QListWidget }

    func (v *Valuelist) DragEnterEvent(e *gui.QDragEnterEvent) {
        e.AcceptProposedAction()
        //  if e.MimeData().HasUrls() {
        //      e.AcceptProposedAction()
        //  }
    }

    func (v *Valuelist) DropEvent(e *gui.QDropEvent) {
        //  if e.MimeData().HasUrls() {
        e.SetDropAction(core.Qt__CopyAction)
        e.AcceptProposedAction()
        e.SetAccepted(true)

        for _, i := range e.MimeData().Formats() { // Urls() ??
            v.AddItem(i)
        }
        //  }
    }

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.