Categorygithub.com/jamalsa/qamel
modulepackage
0.0.0-20240902005621-8c24a35b59ce
Repository: https://github.com/jamalsa/qamel.git
Documentation: pkg.go.dev

# README

Qamel

GoDoc Docker Donate Donate

Qamel is a simple QML binding for Go, heavily inspired by therecipe/qt. This package only binds Qt's classes that used for creating a simple QML app, i.e. QApplication, QQuickView and QQMLApplicationEngine. It's still work-in progress, however it should be stable enough to use in production (as in I'm already using it in prod without problem, your situations may vary).

Features

  • Published under MIT License, which means you can use this binding for whatever you want.
  • Since it only binds the small set of Qt's class, the build time is quite fast.
  • It's available as Docker image, which means you can create QML app without installing Qt in your PC. Go is still needed though.
  • The binding itself is really simple and small. I also think I did a good job on commenting my code, so people should be able to fork it easily.
  • It supports live reload which is really useful while working on GUI.

Limitation

  • I've only tested this in Linux and Windows, so I'm not sure about Mac OS. It should works though, since the code itself is really simple.
  • When declaring custom QML object, this binding only supports basic data type, i.e. int, int32, int64, float32, float64, bool and string. For other data type like struct, array or map, you have to use string type and pass it as JSON value.
  • Thanks to Go and Qt, in theory, the app built using this binding can be cross compiled from and to Windows, Linux and MacOS. However, since I only have Linux and Windows PC, I only able to test cross compiling between Linux and Windows.

Development Status

I've created this binding for my job, so it's actively maintained. However, since I created it for the sake of the job, if the issues are not critical and doesn't affect my job or workflow, it might take a long time before I work on it. Therefore, all PRs and contributors will always be welcomed.

Resources

All documentation for this binding is available in wiki and GoDoc. There are some important sections in wiki that I recommend you to check before you start developing your QML app :

You might also want to check Qt's official documentation about QML :

For demo, you can check out Qamel-HN, a HackerNews reader built with QML and Go.

Licenses

Qamel is distributed under MIT license, which means you can use and modify it however you want. However, if you make an enhancement for it, if possible, please send a pull request. If you like this project, please consider donating to me either via PayPal or Ko-Fi.

# Packages

No description provided by the author
No description provided by the author

# Functions

BorrowObject fetch object for the specified pointer.
DeleteObject remove object for the specified pointer.
ObjectExists checks if object exists in map.
RegisterObject registers the specified pointer to specified object.
ReturnObject returns pointer and lock map again.

# Constants

Black is the thickest font weight, usually used for poster.
Bold is the bold font, usually used for emphasis.
BypassGraphicsProxyWidget prevents the window and its children from automatically embedding themselves into a QGraphicsProxyWidget if the parent widget is already embedded.
BypassWindowManagerHint can be used to indicate to the platform plugin that "all" window manager protocols should be disabled.
CompressHighFrequencyEvents enables compression of certain frequent events.
CompressTabletEvents enables compression of input events from tablet devices.
CoverWindow indicates that the window represents a cover window, which is shown when the application is minimized on some platforms.
CustomizeWindowHint turns off the default window title hints.
DemiBold is similar with Semi Bold in CSS.
Desktop indicates that this widget is the desktop.
Dialog indicates that the widget is a window that should be decorated as a dialog (i.e., typically no maximize or minimize buttons in the title bar).
DisableHighDpiScaling disables high-DPI scaling in Qt, exposing window system coordinates.
DisableShaderDiskCache disables caching of shader program binaries on disk.
DisableWindowContextHelpButton disables the WindowContextHelpButtonHint by default on Qt::Sheet and Qt::Dialog widgets.
DontCheckOpenGLContextThreadAffinity makes a context that created using QOpenGLContext does not check that the QObject thread affinity of the QOpenGLContext object is the same thread calling makeCurrent().
DontCreateNativeWidgetSiblings ensures that siblings of native widgets stay non-native unless specifically set by the Qt::WA_NativeWindow attribute.
DontShowIconsInMenus make actions with the Icon property won't be shown in any menus unless specifically set by the QAction::iconVisibleInMenu property.
DontShowShortcutsInContextMenus make actions with the Shortcut property won't be shown in any shortcut menus unless specifically set by the QAction::shortcutVisibleInContextMenu property.
DontUseNativeDialogs makes all dialogs created while this attribute is set to true won't use the native dialogs provided by the platform.
DontUseNativeMenuBar make all menubars created while this attribute is set to true won't be used as a native menubar (e.g, the menubar at the top of the main screen on macOS).
Drawer indicates that the widget is a drawer on macOS.
EnableHighDpiScaling enables high-DPI scaling in Qt on supported platforms (see also High DPI Displays).
ExtraBold is usually called Heavy, useful for title.
ExtraLight is same with Ultra Light in CSS.
ForceRasterWidgets make top-level widgets use pure raster surfaces, and do not support non-native GL-based child widgets.
ForeignWindow indicates that this window object is a handle representing a native platform window created by another process or by manually using native code.
FramelessWindowHint produces a borderless window.
Light is quite visible and almost normal.
MacDontSwapCtrlAndMeta prevents Qt swaps the Control and Meta (Command) keys in MacOS.
MacWindowToolBarButtonHint on macOS adds a tool bar button (i.e., the oblong button that is on the top right of windows that have toolbars).
MaximizeUsingFullscreenGeometryHint informs the window system that when maximizing the window it should use as much of the available screen geometry as possible, including areas that may be covered by system UI such as status bars or application launchers.
Medium is a bit heavier than normal.
MSWindowsFixedSizeDialogHint gives the window a thin dialog border on Windows.
MSWindowsOwnDC gives the window its own display context on Windows.
NativeWindows ensures that widgets have native windows.
NoDropShadowWindowHint disables window drop shadow on supporting platforms.
Normal is the normal font weight.
PluginApplication indicates that Qt is used to author a plugin.
Popup indicates that the widget is a pop-up top-level window, i.e.
SetPalette indicates whether a palette was explicitly set on the QGuiApplication.
ShareOpenGLContexts enables resource sharing between the OpenGL contexts used by classes like QOpenGLWidget and QQuickWidget.
Sheet indicates that the window is a sheet on macOS.
SizeRootObjectToView makes the view will automatically resize the root item to the size of the view.
SizeViewToRootObject makes the view resizes with the root item in the QML.
SplashScreen indicates that the window is a splash screen.
SubWindow indicates that this widget is a sub-window, such as a QMdiSubWindow widget.
SynthesizeMouseForUnhandledTabletEvents makes all tablet events that are not accepted by the application will be translated to mouse events instead.
SynthesizeMouseForUnhandledTouchEvents make all touch events that are not accepted by the application will be translated to left button mouse events instead.
SynthesizeTouchForUnhandledMouseEvents make all mouse events that are not accepted by the application will be translated to touch events instead.
Thin is barely visible, usually called hairline.
Tool indicates that the widget is a tool window.
ToolTip indicates that the widget is a tooltip.
Use96Dpi assumes the screen has a resolution of 96 DPI rather than using the OS-provided resolution.
UseDesktopOpenGL forces the usage of desktop OpenGL (for example, opengl32.dll or libGL.so) on platforms that use dynamic loading of the OpenGL implementation.
UseHighDpiPixmaps make QIcon::pixmap() generate high-dpi pixmaps that can be larger than the requested size.
UseOpenGLES forces the usage of OpenGL ES 2.0 or higher on platforms that use dynamic loading of the OpenGL implementation.
UseSoftwareOpenGL forces the usage of a software based OpenGL implementation on platforms that use dynamic loading of the OpenGL implementation.
UseStyleSheetPropagationInWidgetStyles enables Qt Style Sheet in regular QWidget.
Widget is the default type for QWidget.
Window indicates that the widget is a window, usually with a window system frame and a title bar, irrespective of whether the widget has a parent or not.
WindowCloseButtonHint adds a close button.
WindowContextHelpButtonHint adds a context help button to dialogs.
WindowDoesNotAcceptFocus informs the window system that this window should not receive the input focus.
WindowFullScreen makes the window fills the entire screen without any frame around it.
WindowFullscreenButtonHint on macOS adds a fullscreen button.
WindowMaximizeButtonHint adds a maximize button.
WindowMaximized makes the window is maximized with a frame around it.
WindowMinimizeButtonHint adds a minimize button.
WindowMinimized makes the window is minimized (i.e.
WindowMinMaxButtonsHint adds a minimize and a maximize button.
WindowNoState makes the window has no state set (in normal state).
WindowOverridesSystemGestures informs the window system that this window implements its own set of gestures and that system level gestures, like for instance three-finger desktop switching, should be disabled.
WindowShadeButtonHint adds a shade button in place of the minimize button if the underlying window manager supports it.
WindowStaysOnBottomHint informs the window system that the window should stay on bottom of all other windows.
WindowStaysOnTopHint informs the window system that the window should stay on top of all other windows.
WindowSystemMenuHint adds a window system menu, and possibly a close button (for example on Mac).
WindowTitleHint gives the window a title bar.
WindowTransparentForInput informs the window system that this window is used only for output (displaying something) and does not take input.
X11BypassWindowManagerHint bypass the window manager completely.

# Structs

QmlObject is the base of QML object.

# Type aliases

Attribute describes attributes that change the behavior of application-wide features.
FontWeight is the weight for thickness of the font.
ResizeMode specifies how to resize the view.
WindowFlags is used to specify various window-system properties for the widget.
WindowStates is used to specify the current state of a top-level window.