Details
-
Suggestion
-
Resolution: Unresolved
-
P3: Somewhat important
-
None
-
5.5.1
Description
If you pass a QWidget as a property to a QJSEngine/QQmlEngine, the following methods/properties of a QWidget are available:
[ "objectName", "modal", "windowModality", "enabled", "geometry", "frameGeometry", "normalGeometry", "x", "y", "pos", "frameSize", "size", "width", "height", "rect", "childrenRect", "childrenRegion", "sizePolicy", "minimumSize", "maximumSize", "minimumWidth", "minimumHeight", "maximumWidth", "maximumHeight", "sizeIncrement", "baseSize", "palette", "font", "cursor", "mouseTracking", "isActiveWindow", "focusPolicy", "focus", "contextMenuPolicy", "updatesEnabled", "visible", "minimized", "maximized", "fullScreen", "sizeHint", "minimumSizeHint", "acceptDrops", "windowTitle", "windowIcon", "windowIconText", "windowOpacity", "windowModified", "toolTip", "toolTipDuration", "statusTip", "whatsThis", "accessibleName", "accessibleDescription", "layoutDirection", "autoFillBackground", "styleSheet", "locale", "windowFilePath", "inputMethodHints", "objectNameChanged", "windowTitleChanged", "windowIconChanged", "windowIconTextChanged", "customContextMenuRequested", "setEnabled", "setDisabled", "setWindowModified", "setWindowTitle", "setStyleSheet", "setFocus", "update", "repaint", "setVisible", "setHidden", "show", "hide", "showMinimized", "showMaximized", "showFullScreen", "showNormal", "close", "raise", "lower", "updateMicroFocus", "grab", "grab" ]
Quite a few are exposed, but it's missing a few like the ability to get/set the: layout, parent, children, button and label text, and properties. There might be a few more on a per-widget basis, but those are the ones that stood out the most to me.
People wanting to do this from JS could do what I did for now and make a function that takes the widget/layout/etc as its arguments and do the operation from the C++ side of things. Example:
injectedQObject.setWidgetLayout(aQWidget, aQWidgetLayout); injectedQObject.setWidgetProperty(aQWidget, 'propertyName', "propertyValue");