gml

package module
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 27, 2020 License: MIT Imports: 13 Imported by: 4

README

Go QML Bindings

Pre-Alpha

Please note that this project is in pre-alpha phase. Documentation is missing and some bugs need to be fixed. Right now, we do not recommend anyone to use anything you find here ;)

Install

go get -u github.com/desertbit/gml/cmd/gml

Samples

See the GML Samples Repo.

Docker Build Containers

The docker image url is: desertbit/gml DockerHub Link

Image Tag Host OS Target OS Qt Link Type Note
linux Linux x86_64 Linux x86_64 dynamic
windows_32_shared Linux x86_64 Windows i686 dynamic
windows_64_shared Linux x86_64 Windows x86_64 dynamic
android Linux x86_64 Android - Not usable - See TODO

Build Tags

  • static: run pkg-config with the static flag. Required for static Qt builds.

Debugging

To debug windows problems, use the MSYS2 console.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddImageProvider

func AddImageProvider(id string, ip *ImageProvider) error

AddImageProvider adds the image provider to the app engine for the given id.

func AddImportPath added in v0.0.4

func AddImportPath(path string)

AddImportPath adds the given import path to the app engine. Hint: Must be called within main thread.

func Exec

func Exec(url string) (retCode int, err error)

Exec load the root QML file located at url, executes the application and returns the exit code. This method is blocking. Hint: Must be called within main thread.

func ExecExit

func ExecExit(url string)

ExecExit load the root QML file located at url, executes the app, prints errors and exits the application with the specific exit code.

func InitListModel

func InitListModel(m interface{})

func Must

func Must(err error)

Must exits the application with a fatal log if the error is present.

func Quit

func Quit()

Quit the application.

func RunMain

func RunMain(f func())

RunMain runs the function on the applications main thread.

func SetApplicationName

func SetApplicationName(name string)

func SetApplicationVersion added in v0.0.15

func SetApplicationVersion(version string)

func SetContextProperty

func SetContextProperty(name string, v interface{}) (err error)

func SetIconThemeName added in v0.0.13

func SetIconThemeName(name string)

SetIconThemeName sets the current icon theme to name.

func SetIconThemeSearchPaths added in v0.0.13

func SetIconThemeSearchPaths(searchPaths ...string)

SetIconThemeSearchPaths sets the search paths for icon themes to paths.

func SetOrganizationName

func SetOrganizationName(name string)

func SetSearchPaths added in v0.0.5

func SetSearchPaths(prefix string, searchPaths []string)

SetSearchPaths sets or replaces Qt's search paths for file names with the prefix prefix to searchPaths. To specify a prefix for a file name, prepend the prefix followed by a single colon (e.g., "images:undo.png", "xmldocs:books.xml"). prefix can only contain letters or numbers (e.g., it cannot contain a colon, nor a slash). Qt uses this search path to locate files with a known prefix. The search path entries are tested in order, starting with the first entry.

Types

type AspectRatioMode

type AspectRatioMode int
const (
	IgnoreAspectRatio          AspectRatioMode = C.GML_IGNORE_ASPECT_RATIO
	KeepAspectRatio            AspectRatioMode = C.GML_KEEP_ASPECT_RATIO
	KeepAspectRatioByExpanding AspectRatioMode = C.GML_KEEP_ASPECT_RATIO_BY_EXPANDING
)

type Image

type Image struct {
	// contains filtered or unexported fields
}

func NewImage

func NewImage() (img *Image)

func (*Image) Copy

func (img *Image) Copy(dst *Image, x, y, width, height int)

func (*Image) Free

func (img *Image) Free()

func (*Image) Height

func (img *Image) Height() (height int)

func (*Image) IsEmpty

func (img *Image) IsEmpty() (empty bool)

func (*Image) LoadFromData

func (img *Image) LoadFromData(data []byte) error

func (*Image) LoadFromFile

func (img *Image) LoadFromFile(filename string) error

func (*Image) LoadFromGoImage

func (img *Image) LoadFromGoImage(gimg image.Image) error

func (*Image) Reset

func (img *Image) Reset()

Reset the image to an empty image.

func (*Image) SetTo

func (img *Image) SetTo(other *Image)

SetTo performs a shallow copy.

func (*Image) Width

func (img *Image) Width() (width int)

type ImageItem

type ImageItem struct {
	// contains filtered or unexported fields
}

func NewImageItem

func NewImageItem(id string) (i *ImageItem)

func (*ImageItem) Release

func (i *ImageItem) Release()

Release this image item. Don't use it anymore after this call, because memory is freed.

func (*ImageItem) ResetImage

func (i *ImageItem) ResetImage()

func (*ImageItem) SetImage

func (i *ImageItem) SetImage(img *Image)

SetImage sets the image by doing a shallow copy.

type ImageProvider

type ImageProvider struct {
	// contains filtered or unexported fields
}

func NewImageProvider

func NewImageProvider(
	aspectRatioMode AspectRatioMode,
	transformMode TransformationMode,
	callback ImageProviderCallback,
) *ImageProvider

func (*ImageProvider) Free

func (ip *ImageProvider) Free()

type ImageProviderCallback

type ImageProviderCallback func(id string, img *Image) error

type ListModel

type ListModel struct {
	Object
	// contains filtered or unexported fields
}

func (*ListModel) Insert

func (lm *ListModel) Insert(row, count int, dataModifier func())

func (*ListModel) Move

func (lm *ListModel) Move(row, count, dstRow int, dataModifier func())

func (*ListModel) Reload

func (lm *ListModel) Reload(row, count int, dataModifier func())

func (*ListModel) Remove

func (lm *ListModel) Remove(row, count int, dataModifier func())

func (*ListModel) Reset

func (lm *ListModel) Reset(dataModifier func())

type ListModelHandler

type ListModelHandler interface {
	RowCount() int
	Data(row int) interface{}
}

type Object

type Object struct {
	// contains filtered or unexported fields
}

func (*Object) GmlObject

func (o *Object) GmlObject() *Object

func (*Object) GmlObject_GoPointer

func (o *Object) GmlObject_GoPointer() unsafe.Pointer

func (*Object) GmlObject_Pointer

func (o *Object) GmlObject_Pointer() unsafe.Pointer

func (*Object) GmlObject_SetGoPointer

func (o *Object) GmlObject_SetGoPointer(goPtr unsafe.Pointer)

func (*Object) GmlObject_SetPointer

func (o *Object) GmlObject_SetPointer(ptr unsafe.Pointer)

type TransformationMode

type TransformationMode int
const (
	FastTransformation   TransformationMode = C.GML_FAST_TRANSFORMATION
	SmoothTransformation TransformationMode = C.GML_SMOOTH_TRANSFORMATION
)

type Variant

type Variant struct {
	// contains filtered or unexported fields
}

TODO: think about adding a ticker routine calling gc... Hint: consider freeing a variant if not required anymore

to release memory as fast as possible.
The go garbage collector does not know about the C++ data
and might not trigger a gc cycle to release memory.
Consider this if you store bigger data values into a variant.

func NewVariantFromPointer

func NewVariantFromPointer(ptr unsafe.Pointer) (v *Variant)

func ToVariant

func ToVariant(i interface{}) *Variant

TODO: free variant again. also add Free method and free as soon as possible within the gen code.

func (*Variant) Decode

func (v *Variant) Decode(i interface{}) (err error)

Pass a pointer.

func (*Variant) Free

func (v *Variant) Free()

func (*Variant) Pointer

func (v *Variant) Pointer() unsafe.Pointer

func (*Variant) Release

func (v *Variant) Release()

Directories

Path Synopsis
cmd
gml
internal
json
json-iterator (https://github.com/json-iterator/go) seems to be even faster than easyjson (https://github.com/mailru/easyjson) and does not require code generation, but is in fact a 100% drop-in replacement for encoding/json.
json-iterator (https://github.com/json-iterator/go) seems to be even faster than easyjson (https://github.com/mailru/easyjson) and does not require code generation, but is in fact a 100% drop-in replacement for encoding/json.
Package pointer is based on: https://github.com/desertbit/go-pointer
Package pointer is based on: https://github.com/desertbit/go-pointer

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL