Thread: [Php-qt-users] QGridLayout
Status: Beta
Brought to you by:
tm243
From: Ferenc V. <li...@ne...> - 2006-01-17 01:14:31
|
Oh, seems the berlios list is still up and running! I forward to sf, just in case! :-) Sorry for sending twice to some readers! -------- Original Message -------- Subject: [Php-qt-users] QGridLayout Date: Tue, 17 Jan 2006 01:45:31 +0100 From: Ferenc Veres <li...@ne...> To: php...@li... Hi, And last a little QGridLayout question. 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 _______________________________________________ Php-qt-users mailing list Php...@li... http://lists.berlios.de/mailman/listinfo/php-qt-users |
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 > _______________________________________________ |
From: Thomas M. <tm...@ip...> - 2006-01-19 00:00:26
|
RmVyZW5jIFZlcmVzIHdyb3RlIG9uIE1pdHR3b2NoLCAxOC4gSmFudWFyIDIwMDYgMjI6MDM6Cj4g SGkgQWxsLAo+Cj4KPiBUZXN0IDEgT0s6IGNvbnRhaW5zIGJvdGggc2xpZGVyIGFuZCBMQ0QgYW5k IGNhbiBiZSBhZGRlZCB0byB0aGUgZ3JpZC4KPiBUZXN0IDIgQ09SRTogY29udGFpbnMgdGhlIExD RCBvbmx5LCBhZGRpbmcgaXQgdG8gdGhlIGdyaWQgZHJvcHMgY29yZS4KPiBUZXN0IDMgT0s6IGNv bnRhaW5zIHRoZSBzbGlkZXIgb25seSwgY2FuIGJlIGFkZGVkIHRvIHRoZSBncmlkLgo+Cj4gJHRo aXMtPmdyaWQtPmFkZFdpZGdldChuZXcgVGVzdDMoKSwgJHJvdywgJGNvbHVtbiwgMCk7Cj4KPiBB bnl3YXksIHdpbGwgaXQgYmUgcG9zc2libGUgdG8gYWRkIHNpbmdsZSB3aWRnZXRzLCBsaWtlIGlu IHRoZSBleGFtcGxlCj4gYmVsb3c/IChXaGljaCB3aWxsIGhhdmUgbm8gYWRkaXRpb25hbCBsYXlv dXQsIGp1c3QgdGhlIHdpZGdldCBpdHNlbGYuKQo+Cj4gVG8gdGVzdCBRR3JpZExheW91dCBJIHRy aWVkIHRvIGNoYW5nZSBteSBsaXR0bGUgdGVzdCBwcm9ncmFtIHRvIHVzZSBpdCwKPiBieSBhZGRp bmc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GRXaWRnZXQoJHRoaXMtPmxjZCk7 CsKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoCR0aGlzLT5z ZXRMYXlvdXQoJHRoaXMtPmxheW91dCk7CsKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKg fQrCoMKgwqDCoMKgwqDCoMKgfQoKU291bmRzIGxpa2UgYSBtZW1vcnkgcHJvYmxlbS4gVGhlIGRl YnVnZ2VyIG1lYW5zIAoweDdlYjExMGI3OiAgICAgQ2Fubm90IGFjY2VzcyBtZW1vcnkgYXQgYWRk cmVzcyAweDdlYjExMGI3CgotLSAKVGhvbWFzCg== |
From: Ferenc V. <li...@ne...> - 2006-01-20 21:36:00
|
Hi all, Thomas Moenicke wrote: > > It runs if I create the Slider but omit it from the layout. > > /* LCD only */ > I checked out the latest version and runs perfect with adding QLineEdit and QPushButton controls to the grid. Great! :-) In my code I have public arrays for all those controls. In tutorial 6, I think the LCDRange() has no public class member variable assigned. (Same in C++ original tutorial.) I don't know if this difference causes changing the line in t6/main.php: $this->grid->addWidget(new QPushButton("a",$this), $row, $column, 0); or $this->grid->addWidget(new QLineEdit("a",$this), $row, $column, 0); to segfault. (Garbage collector kills the referenced QLineEdit?) (I have the same controls in my program and they work well. Anyway, I don't think anyone would create a control without some way to access it (i.e. a class member object). Then I just wonder why the original T6 works. :-) ) Ferenc |
From: Thomas M. <tm...@ip...> - 2006-01-21 12:43:45
|
I fixed that problem. QObjects are stored in a way that ensures safety. You should be able to add every QObject you want. Without any tricks ;-) -- Thomas |