View Single Post

  #1 (permalink)  
Old 11-13-2004
Gyger
 
Posts: n/a
Default extension PHP Qt

Hello,

Three weeks ago, I have started to develop a binding extension for Qt and
PHP 5.

Now, I can display a dialog box containing some widgets like label, buttons
and edit line. I have just implemented some Qt classes (not completly) like
QApplication, QObject, QWidget, Qlabel, QLineEdit and QGrid just to test
some very simple application. The mecanisme of the SLOT and SIGNAL is
working but only for the existing slot and signal.

Now, I would like to implement custom slot and signal but I have some
problems to find the solution for this implementation.

Does somebody has an idee on how it could be possible to implement this
part?


See the following code display an hello world:

<?
if(!extension_loaded('php_qt')) {
dl('php_qt.' . PHP_SHLIB_SUFFIX);
}
class MyApp extends QApplication
{
private $grid;
private $label_version;
private $label_hello;
private $quit_button;
private $about_button;
function __construct()
{
QApplication::QApplication();
$this->init_app();
}

private function init_app()
{
$this->grid = new QGrid(2);
$this->grid->setSpacing(10);
$this->grid->setName("Bonjour MyApp");
$this->label_hello = new QLabel("<center><h1>hello</h1>",$this->grid,
"label_hello");
$this->label_version = new QLabel("<i>PHP Qt</i></center>",$this->grid,
"label_version");
$this->about_button = new QPushButton("About Qt",$this->grid,
"about_button");
$this->quit_button = new QPushButton("Quit",$this->grid, "quit_button");
$this->grid->show();
$this->connect($this->quit_button, SIGNAL("clicked()"), SLOT("quit()"));
$this->connect($this->about_button, SIGNAL"clicked()"),
SLOT("aboutQt()"));
$this->setMainWidget($this->grid);
}
}

$myapp = new MyApp();
$myapp->exec();


?>

Sincerely

Jean-Luc
Reply With Quote