Not sure if there are many people out there who program in both Qt and PHP but...
This is not a formal announcement, (I just wanted to pre-announce this on here) but my company has been working on a framework for PHP that lets you create web applications with a qt-like syntax. Oh, also it uses ajax (if its available on the browser) to make the apps more desktop-like. (Everything (except certain signals) still works if the browser doesn't support ajax, it just has refreshes when you click something)
this is a very simple code example:
(I'm typing this on my Blackberry, so there may be a typo in the syntax lol)
<?php
require_once('QMainWindow.php');
require_once('QApplication.php');
require_once('QLabel.php');
require_once('QPushButton.php');
class win extends QMainWindow {
protected $label;
protected $button;
public function __construct(&$parent) {
parent::__construct($parent);
$this->label = new QLabel('not clicked',$this);
$this->button = new QPushButton('click me',$this);
connect($this->button,SIGNAL('clicked()'),$this,SLOT('changeLabel()'));
connect($this,SIGNAL('updateText(QString)'),$this->label,SLOT('setText(QString)'));
}
public function changeLabel() {
emit('updateText(clicked!)');
}
}
$app = new QApplication;
$w = new $win($app);
$app->exec();
?>
<?php
require_once('QMainWindow.php');
require_once('QApplication.php');
require_once('QLabel.php');
require_once('QPushButton.php');
class win extends QMainWindow {
protected $label;
protected $button;
public function __construct(&$parent) {
parent::__construct($parent);
$this->label = new QLabel('not clicked',$this);
$this->button = new QPushButton('click me',$this);
connect($this->button,SIGNAL('clicked()'),$this,SLOT('changeLabel()'));
connect($this,SIGNAL('updateText(QString)'),$this->label,SLOT('setText(QString)'));
}
public function changeLabel() {
emit('updateText(clicked!)');
}
}
$app = new QApplication;
$w = new $win($app);
$app->exec();
?>
To copy to clipboard, switch view to plain text mode
The above code does exactly what you would expect (and if your browser supports ajax, it does it without a browser refresh) (all of this outputs strict xhtml and standard javascript to the client browser)
Our main goal is to follow the Qt 4.2 API as closely as possible (we already have a QCalendarWidget :-). ) considering that this is for a web browser. We already have reimplemented about 25% of the API and will likely have a beta release in about 6 months. Oh, and it also supports .ui designer files :-) and opperator overloading (if you have the PECL extension complied into php)
One more thing to note, it REQUIRES php 5.2 (which isn't released yet either)(but this is the only server-side requirement) the only requirement on the client side is xhtml support, which even most cell phones have.
:-)
-Katrina
Bookmarks