Documentation ¶
Index ¶
- Constants
- func AddQuickStylePath(path string)
- func BorrowObject(ptr unsafe.Pointer) interface{}
- func DeleteObject(ptr unsafe.Pointer)
- func ObjectExists(ptr unsafe.Pointer) bool
- func RegisterObject(ptr unsafe.Pointer, obj interface{})
- func RegisterQmlListModel(uri string, versionMajor int, versionMinor int, qmlName string)
- func RegisterQmlTableModel(uri string, versionMajor int, versionMinor int, qmlName string)
- func ReturnObject(ptr unsafe.Pointer)
- func SetAttribute(attribute Attribute, on bool)
- func SetQuickStyle(style string)
- func SetQuickStyleFallback(style string)
- type Application
- func (app Application) Exec() int
- func (app Application) SetApplicationDisplayName(name string)
- func (app Application) SetApplicationName(name string)
- func (app Application) SetApplicationVersion(version string)
- func (app Application) SetFont(fontFamily string, pointSize int, weight FontWeight, italic bool)
- func (app Application) SetOrganizationDomain(domain string)
- func (app Application) SetOrganizationName(name string)
- func (app Application) SetQuitOnLastWindowClosed(quit bool)
- func (app Application) SetWindowIcon(fileName string)
- type Attribute
- type Engine
- type FontWeight
- type QObject
- type QmlObject
- type ResizeMode
- type Viewer
- func (view Viewer) ClearComponentCache()
- func (view Viewer) Reload()
- func (view Viewer) SetFlags(flags WindowFlags)
- func (view Viewer) SetHeight(height int)
- func (view Viewer) SetIcon(fileName string)
- func (view Viewer) SetMaximumHeight(height int)
- func (view Viewer) SetMaximumWidth(width int)
- func (view Viewer) SetMinimumHeight(height int)
- func (view Viewer) SetMinimumWidth(width int)
- func (view Viewer) SetOpacity(opacity float64)
- func (view Viewer) SetPosition(x int, y int)
- func (view Viewer) SetResizeMode(resizeMode ResizeMode)
- func (view Viewer) SetSource(url string)
- func (view Viewer) SetTitle(title string)
- func (view Viewer) SetVisible(visible bool)
- func (view Viewer) SetWidth(width int)
- func (view Viewer) SetWindowStates(state WindowStates)
- func (view Viewer) Show()
- func (view Viewer) ShowFullScreen()
- func (view Viewer) ShowMaximized()
- func (view Viewer) ShowMinimized()
- func (view Viewer) ShowNormal()
- func (view Viewer) WatchResourceDir(dirPath string)
- type WindowFlags
- type WindowStates
Constants ¶
const ( // Thin is barely visible, usually called hairline Thin FontWeight = 0 // ExtraLight is same with Ultra Light in CSS ExtraLight = 12 // Light is quite visible and almost normal Light = 25 // Normal is the normal font weight Normal = 50 // Medium is a bit heavier than normal Medium = 57 // DemiBold is similar with Semi Bold in CSS DemiBold = 63 // Bold is the bold font, usually used for emphasis Bold = 75 // ExtraBold is usually called Heavy, useful for title ExtraBold = 81 // Black is the thickest font weight, usually used for poster Black = 87 )
const ( // DontShowIconsInMenus make actions with the Icon property // won't be shown in any menus unless specifically set by // the QAction::iconVisibleInMenu property. // Menus that are currently open or menus already created in // the native macOS menubar may not pick up a change in this // attribute. Changes in the QAction::iconVisibleInMenu property // will always be picked up. DontShowIconsInMenus Attribute = 2 // DontShowShortcutsInContextMenus make actions with the Shortcut // property won't be shown in any shortcut menus unless specifically // set by the QAction::shortcutVisibleInContextMenu property. // This value was added in Qt 5.10. DontShowShortcutsInContextMenus = 28 // NativeWindows ensures that widgets have native windows. NativeWindows = 3 // DontCreateNativeWidgetSiblings ensures that siblings of native // widgets stay non-native unless specifically set by the // Qt::WA_NativeWindow attribute. DontCreateNativeWidgetSiblings = 4 // PluginApplication indicates that Qt is used to author a plugin. // Depending on the operating system, it suppresses specific // initializations that do not necessarily make sense in the plugin case. // For example on macOS, this includes avoiding loading our nib for the // main menu and not taking possession of the native menu bar. Setting // this attribute to true will also set the AA_DontUseNativeMenuBar // attribute to true. It also disables native event filters. This // attribute must be set before QGuiApplication constructed. // This value was added in Qt 5.7. PluginApplication = 5 // 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). DontUseNativeMenuBar = 6 // MacDontSwapCtrlAndMeta prevents Qt swaps the Control and Meta (Command) // keys in MacOS. Whenever Control is pressed, Qt sends Meta, and whenever // Meta is pressed Control is sent. When this attribute is true, Qt will // not do the flip. QKeySequence::StandardKey will also flip accordingly // (i.e., QKeySequence::Copy will be Command+C on the keyboard regardless // of the value set, though what is output for QKeySequence::toString() // will be different). MacDontSwapCtrlAndMeta = 7 // Use96Dpi assumes the screen has a resolution of 96 DPI rather than // using the OS-provided resolution. This will cause font rendering to be // consistent in pixels-per-point across devices rather than defining // 1 point as 1/72 inch. Use96Dpi = 8 // SynthesizeTouchForUnhandledMouseEvents make all mouse events that are // not accepted by the application will be translated to touch events instead. SynthesizeTouchForUnhandledMouseEvents = 11 // SynthesizeMouseForUnhandledTouchEvents make all touch events that are // not accepted by the application will be translated to left button mouse // events instead. This attribute is enabled by default. SynthesizeMouseForUnhandledTouchEvents = 12 // UseHighDpiPixmaps make QIcon::pixmap() generate high-dpi pixmaps that // can be larger than the requested size. Such pixmaps will have // devicePixelRatio() set to a value higher than 1. After setting this // attribute, application code that uses pixmap sizes in layout geometry // calculations should typically divide by devicePixelRatio() to get // device-independent layout geometry. UseHighDpiPixmaps = 13 // ForceRasterWidgets make top-level widgets use pure raster surfaces, // and do not support non-native GL-based child widgets. ForceRasterWidgets = 14 // UseDesktopOpenGL forces the usage of desktop OpenGL (for example, // opengl32.dll or libGL.so) on platforms that use dynamic loading of // the OpenGL implementation. This attribute must be set before // QGuiApplication is constructed. This value was added in Qt 5.3. UseDesktopOpenGL = 15 // UseOpenGLES forces the usage of OpenGL ES 2.0 or higher on platforms // that use dynamic loading of the OpenGL implementation. This attribute // must be set before QGuiApplication is constructed. // This value was added in Qt 5.3. UseOpenGLES = 16 // UseSoftwareOpenGL forces the usage of a software based OpenGL // implementation on platforms that use dynamic loading of the OpenGL // implementation. This will typically be a patched build of Mesa llvmpipe, // providing OpenGL 2.1. The value may have no effect if no such OpenGL // implementation is available. The default name of this library is // opengl32sw.dll and can be overridden by setting the environment variable // QT_OPENGL_DLL. See the platform-specific pages, for instance Qt for // Windows, for more information. This attribute must be set before // QGuiApplication is constructed. This value was added in Qt 5.4. UseSoftwareOpenGL = 17 // used by classes like QOpenGLWidget and QQuickWidget. This allows sharing // OpenGL resources, like textures, between QOpenGLWidget instances that // belong to different top-level windows. This attribute must be set // before QGuiApplication is constructed. This value was added in Qt 5.4. ShareOpenGLContexts = 18 // SetPalette indicates whether a palette was explicitly set on the // QGuiApplication. This value was added in Qt 5.5. SetPalette = 19 // EnableHighDpiScaling enables high-DPI scaling in Qt on supported platforms // (see also High DPI Displays). Supported platforms are X11, Windows and // Android. Enabling makes Qt scale the main (device independent) coordinate // system according to display scale factors provided by the operating system. // This corresponds to setting the QT_AUTO_SCREEN_SCALE_FACTOR environment // variable to 1. This attribute must be set before QGuiApplication is // constructed. This value was added in Qt 5.6. EnableHighDpiScaling = 20 // DisableHighDpiScaling disables high-DPI scaling in Qt, exposing window // system coordinates. Note that the window system may do its own scaling, // so this does not guarantee that QPaintDevice::devicePixelRatio() will be // equal to 1. In addition, scale factors set by QT_SCALE_FACTOR will not be // affected. This corresponds to setting the QT_AUTO_SCREEN_SCALE_FACTOR // environment variable to 0. This attribute must be set before QGuiApplication // is constructed. This value was added in Qt 5.6. DisableHighDpiScaling = 21 // UseStyleSheetPropagationInWidgetStyles enables Qt Style Sheet in regular QWidget. // By default, Qt Style Sheets disable regular QWidget palette and font propagation. // When this flag is enabled, font and palette changes propagate as though the // user had manually called the corresponding QWidget methods. See The Style // Sheet Syntax - Inheritance for more details. This value was added in Qt 5.7. UseStyleSheetPropagationInWidgetStyles = 22 // DontUseNativeDialogs makes all dialogs created while this attribute is // set to true won't use the native dialogs provided by the platform. // This value was added in Qt 5.7. DontUseNativeDialogs = 23 // SynthesizeMouseForUnhandledTabletEvents makes all tablet events that are not // accepted by the application will be translated to mouse events instead. // This attribute is enabled by default. This value was added in Qt 5.7. SynthesizeMouseForUnhandledTabletEvents = 24 // CompressHighFrequencyEvents enables compression of certain frequent events. // On the X11 windowing system, the default value is true, which means that // QEvent::MouseMove, QEvent::TouchUpdate, and changes in window size and position // will be combined whenever they occur more frequently than the application // handles them, so that they don't accumulate and overwhelm the application later. // On other platforms, the default is false. (In the future, the compression // feature may be implemented across platforms.) You can test the attribute to // see whether compression is enabled. If your application needs to handle all // events with no compression, you can unset this attribute. Notice that input // events from tablet devices will not be compressed. See AA_CompressTabletEvents // if you want these to be compressed as well. This value was added in Qt 5.7. CompressHighFrequencyEvents = 25 // CompressTabletEvents enables compression of input events from tablet devices. // Notice that AA_CompressHighFrequencyEvents must be true for events compression // to be enabled, and that this flag extends the former to tablet events. // Its default value is false. This value was added in Qt 5.10. CompressTabletEvents = 29 // 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(). // This value was added in Qt 5.8. DontCheckOpenGLContextThreadAffinity = 26 // DisableShaderDiskCache disables caching of shader program binaries on disk. // By default Qt Quick, QPainter's OpenGL backend, and any application using // QOpenGLShaderProgram with one of its addCacheableShaderFromSource overloads // will employ a disk-based program binary cache in either the shared or // per-process cache storage location, on systems that support glProgramBinary(). // In the unlikely event of this being problematic, set this attribute to // disable all disk-based caching of shaders. DisableShaderDiskCache = 27 // DisableWindowContextHelpButton disables the WindowContextHelpButtonHint by // default on Qt::Sheet and Qt::Dialog widgets. This hides the ? button on // Windows, which only makes sense if you use QWhatsThis functionality. // This value was added in Qt 5.10. In Qt 6, WindowContextHelpButtonHint // will not be set by default. DisableWindowContextHelpButton = 30 )
const ( // Widget is the default type for QWidget. Widgets of this type are child widgets // if they have a parent, and independent windows if they have no parent. Widget WindowFlags = 0x00000000 // 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. Note that it is // not possible to unset this flag if the widget does not have a parent. Window = 0x00000001 // 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). This is the default // type for QDialog. If you want to use it as a modal dialog, it should be launched from // another window, or have a parent and used with the QWidget::windowModality property. // If you make it modal, the dialog will prevent other top-level windows in the application // from getting any input. We refer to a top-level window that has a parent as a secondary window. Dialog = 0x00000002 | Window // Sheet indicates that the window is a sheet on macOS. Since using a sheet implies window // modality, the recommended way is to use QWidget::setWindowModality(), or QDialog::open(), instead. Sheet = 0x00000004 | Window // Drawer indicates that the widget is a drawer on macOS. Drawer = Sheet | Dialog // Popup indicates that the widget is a pop-up top-level window, i.e. that it is modal, but has // a window system frame appropriate for pop-up menus. Popup = 0x00000008 | Window // Tool indicates that the widget is a tool window. A tool window is often a small window with // a smaller than usual title bar and decoration, typically used for collections of tool buttons. // If there is a parent, the tool window will always be kept on top of it. If there isn't a // parent, you may consider using WindowStaysOnTopHint as well. If the window system supports it, // a tool window can be decorated with a somewhat lighter frame. It can also be combined with // FramelessWindowHint. On macOS, tool windows correspond to the NSPanel class of windows. This // means that the window lives on a level above normal windows making it impossible to put a normal // window on top of it. By default, tool windows will disappear when the application is inactive. // This can be controlled by the WA_MacAlwaysShowToolWindow attribute. Tool = Popup | Dialog // ToolTip indicates that the widget is a tooltip. This is used internally to implement tooltips. ToolTip = Popup | Sheet // SplashScreen indicates that the window is a splash screen. This is the default type for QSplashScreen. SplashScreen = ToolTip | Dialog // Desktop indicates that this widget is the desktop. This is the type for QDesktopWidget. Desktop = 0x00000010 | Window // SubWindow indicates that this widget is a sub-window, such as a QMdiSubWindow widget. SubWindow = 0x00000012 // ForeignWindow indicates that this window object is a handle representing a native platform // window created by another process or by manually using native code. ForeignWindow = 0x00000020 | Window // CoverWindow indicates that the window represents a cover window, which is shown when the // application is minimized on some platforms. CoverWindow = 0x00000040 | Window // MSWindowsFixedSizeDialogHint gives the window a thin dialog border on Windows. This style is // traditionally used for fixed-size dialogs. MSWindowsFixedSizeDialogHint = 0x00000100 // MSWindowsOwnDC gives the window its own display context on Windows. MSWindowsOwnDC = 0x00000200 // BypassWindowManagerHint can be used to indicate to the platform plugin that "all" // window manager protocols should be disabled. This flag will behave different depending on what // operating system the application is running on and what window manager is running. The flag // can be used to get a native window with no configuration set. BypassWindowManagerHint = 0x00000400 // X11BypassWindowManagerHint bypass the window manager completely. This results in a borderless // window that is not managed at all (i.e., no keyboard input unless you call // QWidget::activateWindow() manually). X11BypassWindowManagerHint = BypassWindowManagerHint // FramelessWindowHint produces a borderless window. The user cannot move or resize a borderless // window via the window system. On X11, the result of the flag is dependent on the window manager // and its ability to understand Motif and/or NETWM hints. Most existing modern window managers // can handle this. FramelessWindowHint = 0x00000800 // NoDropShadowWindowHint disables window drop shadow on supporting platforms. NoDropShadowWindowHint = 0x40000000 // CustomizeWindowHint turns off the default window title hints. CustomizeWindowHint = 0x02000000 // WindowTitleHint gives the window a title bar. WindowTitleHint = 0x00001000 // WindowSystemMenuHint adds a window system menu, and possibly a close button (for example // on Mac). If you need to hide or show a close button, it is more portable to use WindowCloseButtonHint. WindowSystemMenuHint = 0x00002000 // WindowMinimizeButtonHint adds a minimize button. On some platforms this implies // WindowSystemMenuHint for it to work. WindowMinimizeButtonHint = 0x00004000 // WindowMaximizeButtonHint adds a maximize button. On some platforms this implies // WindowSystemMenuHint for it to work. WindowMaximizeButtonHint = 0x00008000 // WindowMinMaxButtonsHint adds a minimize and a maximize button. On some platforms // this implies WindowSystemMenuHint for it to work. WindowMinMaxButtonsHint = WindowMinimizeButtonHint | WindowMaximizeButtonHint // WindowCloseButtonHint adds a close button. On some platforms this implies // WindowSystemMenuHint for it to work. WindowCloseButtonHint = 0x08000000 // WindowContextHelpButtonHint adds a context help button to dialogs. On some platforms this // implies WindowSystemMenuHint for it to work. WindowContextHelpButtonHint = 0x00010000 // MacWindowToolBarButtonHint on macOS adds a tool bar button (i.e., the oblong button that is // on the top right of windows that have toolbars). MacWindowToolBarButtonHint = 0x10000000 // WindowFullscreenButtonHint on macOS adds a fullscreen button. WindowFullscreenButtonHint = 0x80000000 // BypassGraphicsProxyWidget prevents the window and its children from automatically embedding // themselves into a QGraphicsProxyWidget if the parent widget is already embedded. You can set // this flag if you want your widget to always be a toplevel widget on the desktop, regardless // of whether the parent widget is embedded in a scene or not. BypassGraphicsProxyWidget = 0x20000000 // WindowShadeButtonHint adds a shade button in place of the minimize button if the underlying // window manager supports it. WindowShadeButtonHint = 0x00020000 // WindowStaysOnTopHint informs the window system that the window should stay on top of all // other windows. Note that on some window managers on X11 you also have to pass // X11BypassWindowManagerHint for this flag to work correctly. WindowStaysOnTopHint = 0x00040000 // WindowStaysOnBottomHint informs the window system that the window should stay on bottom of // all other windows. Note that on X11 this hint will work only in window managers that support // _NET_WM_STATE_BELOW atom. If a window always on the bottom has a parent, the parent will // also be left on the bottom. This window hint is currently not implemented for macOS. WindowStaysOnBottomHint = 0x04000000 // WindowTransparentForInput informs the window system that this window is used only for // output (displaying something) and does not take input. Therefore input events should // pass through as if it wasn't there. WindowTransparentForInput = 0x00080000 // 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. WindowOverridesSystemGestures = 0x00100000 // WindowDoesNotAcceptFocus informs the window system that this window should not // receive the input focus. WindowDoesNotAcceptFocus = 0x00200000 // 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. This may // result in the window being placed under these system UIs, but does not guarantee it, // depending on whether or not the platform supports it. When the flag is enabled the user // is responsible for taking QScreen::availableGeometry() into account, so that any UI elements // in the application that require user interaction are not covered by system UI. MaximizeUsingFullscreenGeometryHint = 0x00400000 )
const ( // WindowNoState makes the window has no state set (in normal state). WindowNoState WindowStates = 0x00000000 // WindowMinimized makes the window is minimized (i.e. iconified). WindowMinimized = 0x00000001 // WindowMaximized makes the window is maximized with a frame around it. WindowMaximized = 0x00000002 // WindowFullScreen makes the window fills the entire screen without any frame around it. WindowFullScreen = 0x00000004 )
Variables ¶
This section is empty.
Functions ¶
func AddQuickStylePath ¶
func AddQuickStylePath(path string)
AddQuickStylePath adds path as a directory where Qt Quick Controls 2 searches for available styles. The path may be any local filesystem directory or Qt Resource directory.
func BorrowObject ¶
BorrowObject fetch object for the specified pointer
func DeleteObject ¶
DeleteObject remove object for the specified pointer
func ObjectExists ¶
ObjectExists checks if object exists in map
func RegisterObject ¶
RegisterObject registers the specified pointer to specified object
func RegisterQmlListModel ¶
RegisterQmlListModel registers QamelListModel as QML object
func RegisterQmlTableModel ¶
RegisterQmlTableModel registers QamelTableModel as QML object
func ReturnObject ¶
ReturnObject returns pointer and lock map again
func SetAttribute ¶
SetAttribute sets the Application's attribute if on is true; otherwise clears the attribute
func SetQuickStyle ¶
func SetQuickStyle(style string)
SetQuickStyle sets the application style to style. Note that the style must be configured before loading QML that imports Qt Quick Controls 2. It is not possible to change the style after the QML types have been registered.
func SetQuickStyleFallback ¶
func SetQuickStyleFallback(style string)
SetQuickStyleFallback sets the application fallback style to style. Note that the fallback style must be the name of one of the built-in Qt Quick Controls 2 styles, e.g. "Material".
Types ¶
type Application ¶
type Application struct {
// contains filtered or unexported fields
}
Application is the main app which wraps QGuiApplication
func NewApplication ¶
func NewApplication(argc int, argv []string) *Application
NewApplication initializes the window system and constructs an QGuiApplication object with argc command line arguments in argv.
func (Application) Exec ¶
func (app Application) Exec() int
Exec enters the main event loop and waits until exit() is called, and then returns the value that was set to exit() (which is 0 if exit() is called via quit()).
func (Application) SetApplicationDisplayName ¶
func (app Application) SetApplicationDisplayName(name string)
SetApplicationDisplayName sets the user visible name of this application
func (Application) SetApplicationName ¶
func (app Application) SetApplicationName(name string)
SetApplicationName sets the name of this application
func (Application) SetApplicationVersion ¶
func (app Application) SetApplicationVersion(version string)
SetApplicationVersion sets the version of this application
func (Application) SetFont ¶
func (app Application) SetFont(fontFamily string, pointSize int, weight FontWeight, italic bool)
SetFont changes the default application font
func (Application) SetOrganizationDomain ¶
func (app Application) SetOrganizationDomain(domain string)
SetOrganizationDomain sets the internet domain of the organization that write this application
func (Application) SetOrganizationName ¶
func (app Application) SetOrganizationName(name string)
SetOrganizationName sets the name of the organization that write this application
func (Application) SetQuitOnLastWindowClosed ¶
func (app Application) SetQuitOnLastWindowClosed(quit bool)
SetQuitOnLastWindowClosed set whether the application implicitly quits when the last window is closed. The default is true.
func (Application) SetWindowIcon ¶
func (app Application) SetWindowIcon(fileName string)
SetWindowIcon sets the default window icon from the specified fileName. The fileName could be a relative path (../icon), Qt resource path (qrc://icon), or absolute file path (file://path/to/icon)
type Attribute ¶
type Attribute int64
Attribute describes attributes that change the behavior of application-wide features.
type Engine ¶
type Engine struct {
// contains filtered or unexported fields
}
Engine is the wrapper for QQMLApplicationEngine
func NewEngine ¶
func NewEngine() Engine
NewEngine creates a new QQmlApplicationEngine with the given parent. You will have to call load() later in order to load a QML file.
func NewEngineWithSource ¶
NewEngineWithSource constructs a QQmlApplicationEngine with the given QML source.
func (Engine) ClearComponentCache ¶
func (engine Engine) ClearComponentCache()
ClearComponentCache clears the engine's internal component cache. This function causes the property metadata of all components previously loaded by the engine to be destroyed. All previously loaded components and the property bindings for all extant objects created from those components will cease to function. This function returns the engine to a state where it does not contain any loaded component data. This may be useful in order to reload a smaller subset of the previous component set, or to load a new version of a previously loaded component. Once the component cache has been cleared, components must be loaded before any new objects can be created.
func (Engine) GetFirstRootObject ¶
type FontWeight ¶
type FontWeight int32
FontWeight is the weight for thickness of the font. Qt uses a weighting scale from 0 to 99 similar to, but not the same as, the scales used in Windows or CSS. A weight of 0 will be thin, whilst 99 will be extremely black.
type ResizeMode ¶
type ResizeMode int32
ResizeMode specifies how to resize the view.
const ( // SizeViewToRootObject makes the view resizes with the root item in the QML. SizeViewToRootObject ResizeMode = 0 // SizeRootObjectToView makes the view will automatically resize // the root item to the size of the view. SizeRootObjectToView = 1 )
type Viewer ¶
type Viewer struct {
// contains filtered or unexported fields
}
Viewer is the QML viewer which wraps QQuickView
func NewViewerWithSource ¶
NewViewerWithSource constructs a QQuickView with the given QML source.
func (Viewer) ClearComponentCache ¶
func (view Viewer) ClearComponentCache()
ClearComponentCache clears the engine's internal component cache. This function causes the property metadata of all components previously loaded by the engine to be destroyed. All previously loaded components and the property bindings for all extant objects created from those components will cease to function. This function returns the engine to a state where it does not contain any loaded component data. This may be useful in order to reload a smaller subset of the previous component set, or to load a new version of a previously loaded component. Once the component cache has been cleared, components must be loaded before any new objects can be created.
func (Viewer) SetFlags ¶
func (view Viewer) SetFlags(flags WindowFlags)
SetFlags sets the flags of the window. The window flags control the window's appearance in the windowing system, whether it's a dialog, popup, or a regular window, and whether it should have a title bar, etc. The actual window flags might differ from the flags set with setFlags() if the requested flags could not be fulfilled.
func (Viewer) SetIcon ¶
SetIcon sets the window's icon in the windowing system. The window icon might be used by the windowing system for example to decorate the window, and/or in the task switcher. Note: On macOS, the window title bar icon is meant for windows representing documents, and will only show up if a file path is also set.
func (Viewer) SetMaximumHeight ¶
SetMaximumHeight sets the maximum height of the window.
func (Viewer) SetMaximumWidth ¶
SetMaximumWidth sets the maximum width of the window.
func (Viewer) SetMinimumHeight ¶
SetMinimumHeight sets the minimum height of the window.
func (Viewer) SetMinimumWidth ¶
SetMinimumWidth sets the minimum width of the window.
func (Viewer) SetOpacity ¶
SetOpacity sets the opacity of the window in the windowing system. If the windowing system supports window opacity, this can be used to fade the window in and out, or to make it semitransparent. A value of 1.0 or above is treated as fully opaque, whereas a value of 0.0 or below is treated as fully transparent. Values inbetween represent varying levels of translucency between the two extremes. The default value is 1.0.
func (Viewer) SetPosition ¶
SetPosition sets the position of the window on the desktop to x, y.
func (Viewer) SetResizeMode ¶
func (view Viewer) SetResizeMode(resizeMode ResizeMode)
SetResizeMode sets whether the view should resize the window contents. If this property is set to SizeViewToRootObject (the default), the view resizes to the size of the root item in the QML. If this property is set to SizeRootObjectToView, the view will automatically resize the root item to the size of the view.
func (Viewer) SetSource ¶
SetSource sets the source to the url, loads the QML component and instantiates it. The source could be a Qt resource path (qrc://icon) or a file path (file://path/to/icon). However, it must be a valid path.
func (Viewer) SetTitle ¶
SetTitle sets the window's title in the windowing system. The window title might appear in the title area of the window decorations, depending on the windowing system and the window flags. It might also be used by the windowing system to identify the window in other contexts, such as in the task switcher.
func (Viewer) SetVisible ¶
SetVisible sets whether the window is visible or not. This property controls the visibility of the window in the windowing system. By default, the window is not visible, you must call setVisible(true), or show() or similar to make it visible.
func (Viewer) SetWindowStates ¶
func (view Viewer) SetWindowStates(state WindowStates)
SetWindowStates sets the screen-occupation state of the window. The window state represents whether the window appears in the windowing system as maximized, minimized and/or fullscreen. The window can be in a combination of several states. For example, if the window is both minimized and maximized, the window will appear minimized, but clicking on the task bar entry will restore it to the maximized state.
func (Viewer) Show ¶
func (view Viewer) Show()
Show shows the window. This is equivalent to calling showFullScreen(), showMaximized(), or showNormal(), depending on the platform's default behavior for the window type and flags.
func (Viewer) ShowFullScreen ¶
func (view Viewer) ShowFullScreen()
ShowFullScreen shows the window as fullscreen. Equivalent to calling setWindowStates(WindowFullScreen) and then setVisible(true).
func (Viewer) ShowMaximized ¶
func (view Viewer) ShowMaximized()
ShowMaximized shows the window as maximized. Equivalent to calling setWindowStates(WindowMaximized) and then setVisible(true).
func (Viewer) ShowMinimized ¶
func (view Viewer) ShowMinimized()
ShowMinimized shows the window as minimized. Equivalent to calling setWindowStates(WindowMinimized) and then setVisible(true).
func (Viewer) ShowNormal ¶
func (view Viewer) ShowNormal()
ShowNormal shows the window as normal, i.e. neither maximized, minimized, nor fullscreen. Equivalent to calling setWindowStates(WindowNoState) and then setVisible(true).
func (Viewer) WatchResourceDir ¶
WatchResourceDir watches for change inside the specified resource dir. When change happened, the view will be reloaded immediately. The directory path must be absolute. Only use this in development environment.
type WindowFlags ¶
type WindowFlags int32
WindowFlags is used to specify various window-system properties for the widget. They are fairly unusual but necessary in a few cases. Some of these flags depend on whether the underlying window manager supports them.
type WindowStates ¶
type WindowStates int32
WindowStates is used to specify the current state of a top-level window.