Есть идея, для реализации которой необходимо динамически добавлять или убирать строки ввода (работа с древовидными данными).
Возможно ли это в PHPQt5, и как ?
<?php
class myWidget extends QWidget {
private $fields = [];
private $row = 0;
private $col = 0;
public function __construct() {
parent::__construct(null);
$this->setLayout(new QGridLayout());
}
public function addField() {
$field = new QLineEdit($this);
if($this->col > 6) {
$this->row = 0;
$this->col = 0;
}
$this->layout()->addWidget($field, $this->row, $this->col++);
$this->fields[] = $field;
}
}