Skip to content

Files

Latest commit

9b56947 · Mar 20, 2023

History

History
78 lines (39 loc) · 3.75 KB

CustomUI-PORTING-GUIDE.md

File metadata and controls

78 lines (39 loc) · 3.75 KB

CustomUI Porting Guide

This guide describes how to port old simUI-based code to QML / QtQuick for the simQML plugin.

UI creation and destruction

One should use simQML.load(engine,path) (or simQML.loadData(engine,data)) to load a component in the QML engine.

The top-level component to use to create a window, that behaves similarly to simUI's <ui> is PluginWindow.

There is no direct control of which windows are created, and it is not possible to destroy windows from Lua.

Instead, events should be sent via simQML.sendEvent(), and windows management should be handled in the QML engine (see README.md).

<ui> attributes

title is supported by QtQuick.Window.

modal is QtQuick.Window's modality.

resizable and closable are convenience properties provided by QML type PluginWindow; the same is possible via QtQuick.Window's flags.

style is not supported: QtQuick don't use Qt stylesheets.

layout is not supported: QtQuick.Layouts should be used instead.

content-margins is not supported: use related QtQuick properties.

placement, position and size are not provided. Use property x, y, width, height of the window and of Screen.

activate is not supported: use a suitable QtQuick.Window's flags.

on-close: use the onClosing handler of PluginWindow / QtQuick.Window.

Widgets

<button>: use QtQuick.Controls.Button

<checkbox>: use QtQuick.Controls.CheckBox

<combobox>: use QtQuick.Controls.ComboBox

<edit>: use QtQuick.Controls.TextField

<group>: use QtQuick.Controls.CheckBox

<hslider>: use QtQuick.Controls.Slider

<image>: use QtQuick.Image

<label>: use QtQuick.Controls.Label

<plot>: use QtQuick.Controls.CheckBox

<progressbar>: use QtQuick.Controls.ProgressBar

<radiobutton>: use QtQuick.Controls.RadioButton

<scene3d>: use QtQuick.Scene3D

<spinbox>: use QtQuick.Controls.SpinBox

<table>: use QtQuick.TableView

<tabs>: use QtQuick.Controls.CheckBox

<tab>: use QtQuick.Controls.TabBar

<text-browser>: use QtQuick.Controls.TextArea

<tree>: use QtQuick.TreeView

<vslider>: use QtQuick.Controls.Slider

<svg>: use QtQuick.Image

<br>, <stretch>: use QtQuick.Layouts system.