Home / PHP-Qt System Tray Icon Demo

Tray Icons and Messages with PHP

This movie demonstrates the system tray icon in PHP-Qt.

The most basic code to create a tray icon is listed below.

         $this->trayIcon = new QSystemTrayIcon();
         //choose any icon for the toolbar
	 $icon = new QIcon("./images/heart.png");
         $this->trayIcon->setIcon($icon);

In Qt 4, the tray icon can display pop-up messages similar to those found in Windows XP. The tray messaes can have one of 3 built-in icons (infomration, warnings, and ciritcal errors). The messages also have a configurable duration after which they will disappear without user intervention.

        //get the built-in icon
        $icon = QSystemTrayIcon::Information();
        $this->trayIcon->showMessage($this->titleEdit->text(),
                $this->bodyEdit->toPlainText(), $icon,
                $this->durationSpinBox->value() * 1000);

This movie shows a small demo application which allows you to change all the different values for a system tray icon. This example was originally created in C++ for the default Qt API. The tray icon example was then ported to python for the python Qt bindings. The python example was then ported to PHP and can be found in the examples folder of phpqt inside KDE's "kdebindings" repository: http://websvn.kde.org/trunk/KDE/kdebindings/php/phpqt/

Get the Flash Player to see this video.

See the PHP-Qt Calculator Example