Re: [Php-qt-users] QGridLayout
Status: Beta
Brought to you by:
tm243
From: Ferenc V. <li...@ne...> - 2006-01-18 21:04:12
|
Hi All, I still don't get it. I tried to change tutorial 6 to add a different widgets to the grid, please see the following modifications of "LCDRange" original example class: /* LCD and slider */ class Test1 extends QWidget { public $lcd; public $slider; public $layout; function __construct() { parent::__construct(); $this->lcd = new QLCDNumber(2,$this); $this->slider = new QSlider($this); $this->layout = new QVBoxLayout($this); $this->layout->addWidget($this->lcd); $this->layout->addWidget($this->slider); $this->setLayout($this->layout); } } /* LCD only */ class Test2 extends QWidget { public $lcd; public $layout; function __construct() { parent::__construct(); $this->lcd = new QLCDNumber(2,$this); $this->layout = new QVBoxLayout($this); $this->layout->addWidget($this->lcd); $this->setLayout($this->layout); } } /* Slider only */ class Test3 extends QWidget { public $slider; public $layout; function __construct() { parent::__construct(); $this->slider = new QSlider($this); $this->layout = new QVBoxLayout($this); $this->layout->addWidget($this->slider); $this->setLayout($this->layout); } } Test 1 OK: contains both slider and LCD and can be added to the grid. Test 2 CORE: contains the LCD only, adding it to the grid drops core. Test 3 OK: contains the slider only, can be added to the grid. $this->grid->addWidget(new Test3(), $row, $column, 0); Anyway, will it be possible to add single widgets, like in the example below? (Which will have no additional layout, just the widget itself.) To test QGridLayout I tried to change my little test program to use it, by adding Button or QLineEdit. Seems it works only with the Tutorial 6 class at the moment. ;-) Many thanks, Ferenc Ferenc Veres wrote: > Why tutoruial 6 stops working if I change the grid's internal control to > QLineEdit like this: > > $this->grid->addWidget(new QLineEdit("na", $this), $row, $column, 0); > > If "$this" is the problem, what do you advice to solve it? > > (I have similar problem with my program what I try to convert to use > QGridLayout, but that actually displays all controls in the top left > corner, no segfault.) > > Thanks, > Ferenc > _______________________________________________ |