On this page

ControlPanelUtils QML Type

A singleton providing helper functions for type conversion and default value creation. More...

Import Statement: import QtInterfaceFramework.ControlPanelHelper 1.0
Inherits:

QtObject

Methods

Detailed Description

ControlPanelUtils is used internally by the control panel controls to parse user input into the correct JavaScript type and to create default values when new items are added to lists or models.

Functions

  • parseValue() – converts a string to the JavaScript type indicated by a type name ("int", "real", "bool", or "string").
  • getDefaultValue() – returns a sensible default for a given type, including recursive struct construction.

Usage

var intVal = ControlPanelUtils.parseValue("42", "int")   // 42
var defVal = ControlPanelUtils.getDefaultValue("bool")   // false

Method Documentation

getDefaultValue(type, structFields, enumModel)

Returns a sensible default value for the given type. For "struct" types, structFields is used to recursively build an object. For "enum" types, the first entry in enumModel is returned.

parseValue(text, type)

Parses the string text into the JavaScript type specified by type. Returns 0 for invalid "int" or "real" input.

© 2026 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.