TypePHP\Qt
Guide
Widgets
Advanced
Reference
FAQ
  • English
  • 简体中文
GitHub
Guide
Widgets
Advanced
Reference
FAQ
  • English
  • 简体中文
GitHub
  • Widget Catalog

    • Widget Catalog
    • Containers
    • Input Controls
    • Data Controls
    • Display Controls
    • WebView

Widget Catalog

Every control is built by a static method on TypePHP\Qt\WidgetTree, returning an array node. A node looks like:

['type' => 'button', 'props' => ['id' => 'ok', 'text' => 'OK'], 'children' => []]

You never write that structure by hand — use the factory:

WidgetTree::button('OK', ['id' => 'ok']);

Browse by category

CategoryContains
Containersvbox hbox grid form group frame scroll tabs tab stack page split spacer separator
Inputslineedit textedit spin doublespin slider checkbox radio combo
Datalist table tree
Displaylabel button progress image link
WebViewwebview

Cheat sheet

MethodWhat it isMain properties
vbox($children)vertical layoutspacing margin
hbox($children)horizontal layoutspacing margin
grid($children)grid layoutrow col row_span col_span
form($children)two-column form—
group($title, $children)titled group boxtitle
frame($children)untitled containerstyle
scroll($children)scroll area—
tabs($pages)tab widgettab_position current
tab($title, $children)a single tabtitle
stack($pages)untitled stackcurrent
page($children)one page of a stack—
split($children)draggable splitterorientation sizes
spacer($size)flexible gapsize
separator()divider line—
label($text)text labeltext bold font_size align
button($text)push buttontext checkable checked flat default
lineEdit($text)single-line inputtext placeholder password clear_button max_length
textEdit($text)multi-line inputtext wrap readonly
spin($value)integer spinnervalue min max step prefix suffix
doubleSpin($value)float spinneras above + decimals
slider($value)slidervalue min max orientation ticks
progress($value)progress barvalue min max
checkbox($text, $checked)checkboxchecked
radio($text, $checked)radio buttonchecked
combo($items, $current)combo boxitems current editable
list($items, $current)list widgetitems current multi
table($columns, $rows)tablecolumns rows row_ids current
tree($nodes)treenodes headers current
image($path)imagepath scaled_size
link($text, $href)hyperlinktext href

Common to every node

id visible enabled tooltip style size min_size max_size align grow

Full property tables: Properties.

A composed example

WidgetTree::vbox([
    WidgetTree::group('Search', [
        WidgetTree::hbox([
            WidgetTree::lineEdit($state->query, ['id' => 'q', 'placeholder' => 'Keyword', 'grow' => 1]),
            WidgetTree::button('Search', ['id' => 'go']),
        ]),
    ]),

    WidgetTree::table(
        ['Name', 'Qty', 'Status'],
        $state->rows(),
        ['id' => 'tbl', 'row_ids' => $state->rowIds(), 'stretch_last' => true, 'grow' => 1]
    ),

    WidgetTree::hbox([
        WidgetTree::checkbox('Pending only', $state->onlyPending, ['id' => 'filter']),
        WidgetTree::spacer(1),
        WidgetTree::progress($state->progress, ['id' => 'bar', 'max' => 100]),
    ]),
]);
Edit this page on GitHub
Last updated: 10/6/26, 3:13 AM
Next
Containers