<?php /**************************************************************** ** ** Qt tutorial 3 ** ** original: ** http://doc.trolltech.com/4.1/tutorial-t3.html ** ****************************************************************/ if (!extension_loaded('php_qt')) { dl('php_qt.' . PHP_SHLIB_SUFFIX); } $app = new QApplication($argc, $argv); $window = new QWidget(); $window->resize(200, 120); $quit = new QPushButton("Quit", $window); $quit->setFont(new QFont("Times", 18, QFont::Bold)); $quit->setGeometry(10, 40, 180, 40); QObject::connect($quit, SIGNAL('clicked()'), $app, SLOT('quit()')); $window->show(); $app->exec();
function testObjectLifeCycle() { echo "testing deletion of object "; $color_a = new QColor(1, 3, 5); $color_a->__destruct(); unset($color_a); $this->assertFalse(isset($color_a), "Object wasn't deleted properly\n"); echo "passed\n"; echo "testing returning a Stack item, checking values "; $widget_a = new QWidget(); $widget_a->resize(24, 28); $size_a = $widget_a->size(); $this->assertEquals($size_a->width(), $widget_a->width(), "return value of QWidget::size() is not correct\n"); echo "passed\n"; echo "testing returning a Stack item, changing values "; $widget_a->resize(26, 30); $size_b = $widget_a->size(); $this->assertEquals($size_b->width(), 26, ""); $this->assertEquals($size_a->width(), 24, ""); // $this->assertEquals( $widget_a->size(), $size_b->width() ); }