Example #1
0
 public function __construct()
 {
     parent::__construct();
     $quit = new QPushButton(tr("&Quit"));
     $quit->setFont(new QFont("Times", 18, QFont::Bold));
     QObject::connect($quit, SIGNAL('clicked()'), QApplication::instance(), SLOT('quit()'));
     $angle = new LCDRange();
     $angle->setRange(5, 70);
     $force = new LCDRange();
     $force->setRange(10, 50);
     $cannonField = new CannonField();
     QObject::connect($angle, SIGNAL('valueChanged(int)'), $cannonField, SLOT('setAngle(int)'));
     QObject::connect($cannonField, SIGNAL('angleChanged(int)'), $angle, SLOT('setValue(int)'));
     QObject::connect($force, SIGNAL('valueChanged(int)'), $cannonField, SLOT('setForce(int)'));
     QObject::connect($cannonField, SIGNAL('forceChanged(int)'), $force, SLOT('setValue(int)'));
     $shoot = new QPushButton(tr("&Shoot"));
     $shoot->setFont(new QFont("Times", 18, QFont::Bold));
     QObject::connect($shoot, SIGNAL('clicked()'), $cannonField, SLOT('shoot()'));
     $topLayout = new QHBoxLayout();
     $topLayout->addWidget($shoot);
     $topLayout->addStretch(1);
     $leftLayout = new QVBoxLayout();
     $leftLayout->addWidget($angle);
     $leftLayout->addWidget($force);
     $gridLayout = new QGridLayout();
     $gridLayout->addWidget($quit, 0, 0);
     $gridLayout->addLayout($topLayout, 0, 1);
     $gridLayout->addLayout($leftLayout, 1, 0);
     $gridLayout->addWidget($cannonField, 1, 1, 2, 1);
     $gridLayout->setColumnStretch(1, 10);
     $this->setLayout($gridLayout);
     $angle->setValue(60);
     $force->setValue(25);
     $angle->setFocus();
 }
Example #2
0
 public function __construct()
 {
     parent::__construct();
     $this->textEdit_static_text = tr('Downloading PQPack package');
     $this->setWindowFlags(Qt::MSWindowsFixedSizeDialogHint | Qt::WindowStaysOnTopHint | Qt::WindowTitleHint);
     $this->downloader = new PQFileDownloader();
     $this->downloader->connect(SIGNAL('downloaded()'), $this, SLOT('downloaded()'));
     $this->downloader->connect(SIGNAL('downloadProgress(qint64,qint64)'), $this, SLOT('downloadProgress(qint64,qint64)'));
     $this->textEdit = new QTextEdit($this);
     $this->textEdit->html = $this->textEdit_static_text . '... (0Kb of 0Kb)';
     $this->textEdit->readOnly = true;
     $this->textEdit->minimumHeight = $this->textEdit->maximumHeight = 80;
     $this->progressBar = new QProgressBar($this);
     $this->progressBar->setMinimumSize(450, 30);
     $this->button = new QPushButton($this);
     $this->button->text = tr('Continue');
     $this->button->enabled = false;
     $this->button->connect(SIGNAL('clicked()'), $this, SLOT('close()'));
     $this->button->minimumHeight = 30;
     $layout = new QVBoxLayout();
     $layout->addWidget($this->textEdit);
     $layout->addWidget($this->progressBar);
     $layout->addWidget($this->button);
     $this->setLayout($layout);
 }
Example #3
0
 public function setupUi($Dialog)
 {
     if ($Dialog->objectName()->isEmpty()) {
         $Dialog->setObjectName(QString::fromUtf8("Dialog"));
     }
     $size = new QSize(394, 311);
     $size = $size->expandedTo($Dialog->minimumSizeHint());
     $Dialog->resize($size);
     $this->buttonBox = new QDialogButtonBox($Dialog);
     $buttonBox = $this->buttonBox;
     // scope
     $buttonBox->setObjectName(QString::fromUtf8("buttonBox"));
     $buttonBox->setGeometry(new QRect(40, 270, 341, 32));
     $buttonBox->setOrientation(Qt::Horizontal);
     $buttonBox->setStandardButtons(QDialogButtonBox::Cancel | QDialogButtonBox::NoButton | QDialogButtonBox::Ok);
     $this->textBrowser = new QTextBrowser($Dialog);
     $textBrowser = $this->textBrowser;
     // scope
     $textBrowser->setObjectName(QString::fromUtf8("textBrowser"));
     $textBrowser->setGeometry(new QRect(10, 10, 371, 211));
     $this->lineEdit = new QLineEdit($Dialog);
     $lineEdit = $this->lineEdit;
     // scope
     $lineEdit->setObjectName(QString::fromUtf8("lineEdit"));
     $lineEdit->setGeometry(new QRect(10, 230, 371, 25));
     $this->retranslateUi($Dialog);
     QObject::connect($buttonBox, SIGNAL('accepted()'), $Dialog, SLOT('accept()'));
     QObject::connect($buttonBox, SIGNAL('rejected()'), $Dialog, SLOT('reject()'));
     QMetaObject::connectSlotsByName($Dialog);
 }
Example #4
0
 function __construct()
 {
     parent::__construct();
     $this->setFixedSize(200, 120);
     $this->quit = new QPushButton(tr("Quit"), $this);
     $this->quit->setGeometry(62, 40, 75, 30);
     $this->quit->setFont(new QFont("Times", 18, QFont::Bold));
     /* the macro qApp is not available in php-qt, we use QApplication::instance() directly. */
     $this->connect($this->quit, SIGNAL('clicked()'), QApplication::instance(), SLOT('quit()'));
 }
Example #5
0
 public function setupConnections()
 {
     $this->quit = new QPushButton(tr("Quit"));
     $this->quit->setFont(new QFont("Times", 18, QFont::Bold));
     QObject::connect($this->quit, SIGNAL('clicked()'), QApplication::instance(), SLOT('quit()'));
     $this->angle = new LCDRange();
     $this->angle->setRange(5, 70);
     /*
     $this->cannonField = new CannonField();
     */
     //    QObject::connect($this->angle, SIGNAL('valueChanged(int)'), $this->cannonField, SLOT('setAngle(int)'));
     //    QObject::connect($this->cannonField, SIGNAL('angleChanged(int)'), $this->angle, SLOT('setValue(int)'));
 }
Example #6
0
 public function __construct()
 {
     parent::__construct();
     $this->currentAngle = 45;
     $this->currentForce = 0;
     $this->timerCount = 0;
     $this->autoShootTimer = new QTimer($this);
     QObject::connect($this->autoShootTimer, SIGNAL('timeout()'), $this, SLOT('moveShot()'));
     $this->shootAngle = 0;
     $this->shootForce = 0;
     $this->setPalette(new QPalette(new QColor(250, 250, 200)));
     $this->setAutoFillBackground(true);
     $this->barrelRect = new QRect(30, -5, 20, 10);
 }
Example #7
0
 public function __construct($events, $startIndex, $parent = 0)
 {
     parent::__construct($parent);
     $this->startIndex = $startIndex;
     /*
             $this->csPath = c(PQNAME)->csPath;
             $this->csEvents = c(PQNAME)->csEvents;
             $this->csName = c(PQNAME)->csName;
             
             $component = get_class($object);
             
             $events = array();
             while ($component != null) {
                 $componentPath = $this->csPath . "/$component/" . $this->csName;
                 $eventsPath = $this->csPath . "/$component/" . $this->csEvents;
                 
                 $r = array();
                 
                 if (file_exists($eventsPath) && is_file($eventsPath)) {
                     require ($eventsPath);
     
                     if (count($r) > 0) {
                         $events[$component] = $r;
                     }
                 }
     
                 $component = null;
                 require($componentPath);
     
                 if (isset($r['parent']) && !empty(trim($r['parent']))) {
                     $component = $r['parent'];
                 }
             }
             
             $list = new QListWidget($this);
             $list->alternatingRowColors = true;
             $list->connect(SIGNAL('itemDoubleClicked(int)'), $this, SLOT('itemDoubleClicked(int)'));
             
             foreach($events as $c => $e) {
                 foreach($e as $event) {
                     $list->addItem($event['event']);
                 }
             }*/
     $list = new QListWidget($this);
     $list->alternatingRowColors = true;
     $list->connect(SIGNAL('itemDoubleClicked(int)'), $this, SLOT('itemDoubleClicked(int)'));
     foreach ($events as $eventIndex => $event) {
         $list->addItem($event['event']);
     }
 }
Example #8
0
 public function __construct()
 {
     parent::__construct();
     $this->lcd = new QLCDNumber(2);
     $this->lcd->setSegmentStyle(QLCDNumber::Filled);
     $this->slider = new QSlider(Qt::Horizontal);
     $this->slider->setRange(0, 99);
     $this->slider->setValue(0);
     $this->connect($this->slider, SIGNAL('valueChanged(int)'), $this->lcd, SLOT('display(int)'));
     $this->connect($this->slider, SIGNAL('valueChanged(int)'), $this, SIGNAL('valueChanged(int)'));
     $layout = new QVBoxLayout();
     $layout->addWidget($this->lcd);
     $layout->addWidget($this->slider);
     $this->setLayout($layout);
     $this->setFocusProxy($this->slider);
 }
Example #9
0
 function __construct()
 {
     parent::__construct();
     $this->quit = new QPushButton(tr("Quit"));
     $this->quit->setFont(new QFont("Times", 18, QFont::Bold));
     $this->connect($this->quit, SIGNAL('clicked()'), QApplication::instance(), SLOT('quit()'));
     $this->grid = new QGridLayout();
     for ($row = 0; $row < 4; ++$row) {
         for ($column = 0; $column < 4; ++$column) {
             $this->grid->addWidget(new LCDRange(), $row, $column);
         }
     }
     $this->layout = new QVBoxLayout();
     $this->layout->addWidget($this->quit);
     $this->layout->addLayout($this->grid);
     $this->setLayout($this->layout);
 }
Example #10
0
 function __construct()
 {
     parent::__construct();
     $this->quit = new QPushButton(tr("Quit"));
     $this->quit->setFont(new QFont("Times", 18, QFont::Bold));
     $this->lcd = new QLCDNumber(2);
     $this->lcd->setSegmentStyle(QLCDNumber::Filled);
     $this->slider = new QSlider(Qt::Horizontal);
     $this->slider->setRange(0, 99);
     $this->slider->setValue(0);
     $this->connect($this->quit, SIGNAL('clicked()'), QApplication::instance(), SLOT('quit()'));
     $this->connect($this->slider, SIGNAL('valueChanged(int)'), $this->lcd, SLOT('display(int)'));
     $this->layout = new QVBoxLayout();
     $this->layout->addWidget($this->quit);
     $this->layout->addWidget($this->lcd);
     $this->layout->addWidget($this->slider);
     $this->setLayout($this->layout);
 }
Example #11
0
 public function __construct()
 {
     parent::__construct();
     $quit = new QPushButton(tr("Quit"));
     $quit->setFont(new QFont("Times", 18, QFont::Bold));
     //	    QObject::connect($quit, SIGNAL('clicked()'), qApp(), SLOT('quit()'));
     QObject::connect($quit, SIGNAL('clicked()'), QApplication::instance(), SLOT('quit()'));
     $angle = new LCDRange();
     $angle->setRange(5, 70);
     $cannonField = new CannonField();
     QObject::connect($angle, SIGNAL('valueChanged(int)'), $cannonField, SLOT('setAngle(int)'));
     QObject::connect($cannonField, SIGNAL('angleChanged(int)'), $angle, SLOT('setValue(int)'));
     $gridLayout = new QGridLayout();
     $gridLayout->addWidget($quit, 0, 0);
     $gridLayout->addWidget($angle, 1, 0);
     $gridLayout->addWidget($cannonField, 1, 1, 2, 1);
     $gridLayout->setColumnStretch(1, 10);
     $this->setLayout($gridLayout);
     $angle->setValue(60);
     $angle->setFocus();
 }
Example #12
0
 /**
  * @return QPushButton
  */
 private function createButton(QString $text, QWidget $receiver, $member)
 {
     $button = new QPushButton($text);
     $button->connect($button, SIGNAL("clicked()"), $receiver, (string) $member);
     return $button;
 }
Example #13
0
 private function create_button($text, $icon, $slot = '', $enabled = true, $align = 'left')
 {
     $widget = new QWidget($this);
     $button = new QPushButton($widget);
     $button->text = $text;
     $button->setMinimumSize(200, 36);
     $button->enabled = $enabled;
     $button->styleSheet = "text-align:{$align};padding-left:50px;padding-right:20px;font-size:14px;";
     $label = new QLabel($widget);
     $label->icon = $this->iconsPath . "/{$icon}";
     $label->resize(32, 32);
     $label->enabled = $enabled;
     $label->move(10, 0);
     if (!empty($slot)) {
         $button->connect(SIGNAL('clicked(bool)'), $this, $slot);
         $label->connect(SIGNAL('mouseClicked()'), $button, SLOT('click()'));
     }
     $layout = new QHBoxLayout();
     $layout->setContentsMargins(0, 6, 0, 0);
     $layout->addWidget($button);
     $widget->setLayout($layout);
     return $widget;
 }
Example #14
0
 public function __construct()
 {
     parent::__construct();
     $this->connect($this, SIGNAL('testSignal()'), $this, SLOT('testSlot()'));
     $this->connect($this, SIGNAL('testSignal()'), $this, SLOT('show()'));
     $this->connect($this, SIGNAL('testSignalSignal()'), $this, SIGNAL('clicked()'));
     //		$this->connect( $this, SIGNAL('clicked()'), $this, SLOT('testSlot()') );
     //		$this->connect( $this, SIGNAL('clicked()'), $this, SLOT('toggle()') );
     $this->connect($this, SIGNAL('pressed()'), $this, SIGNAL('testSignalSignal()'));
     $this->connect($this, SIGNAL('released()'), $this, SIGNAL('pressed()'));
     $this->connect($this, SIGNAL('clicked(bool)'), $this, SLOT('setChecked(bool)'));
     $this->slotTester = "";
 }
{
    private $mainWidget;
    public $button1;
    public $button2;
    function __construct()
    {
        $mainWidget = new QWidget();
        parent::__construct(QBoxLayout::TopToBottom, $mainWidget);
        $this->mainWidget = $mainWidget;
        $this->button1 = new QPushButton("About Qt!");
        $this->button2 = new QPushButton("Quit");
        $this->addWidget($this->button1);
        $this->addWidget($this->button2);
    }
    function __destruct()
    {
        $this->button1 = 0;
        $this->button2 = 0;
        $this->mainWidget = 0;
    }
    function show()
    {
        $this->mainWidget->show();
    }
}
$app = new QApplication($argc, $argv);
$box = new Box();
$box->show();
QObject::connect($box->button1, SIGNAL("clicked()"), $app, SLOT("aboutQt()"));
QObject::connect($box->button2, SIGNAL("clicked()"), $app, SLOT("quit()"));
$app->exec();
 function createButton($text, $color, $member)
 {
     $button = new Button($text, $color);
     $this->connect($button, SIGNAL('clicked()'), $this, $member);
     return $button;
 }
Example #17
0
 public function __construct($fileName, QWidget $parent = NULL)
 {
     parent::__construct($parent);
     $fileInfo = new QFileInfo($fileName);
     $this->tabWidget = new QTabWidget();
     $this->tabWidget->addTab(new GeneralTab($fileInfo), tr("General"));
     $this->tabWidget->addTab(new PermissionsTab($fileInfo), tr("Permissions"));
     $this->tabWidget->addTab(new ApplicationsTab($fileInfo), tr("Applications"));
     $this->buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel);
     $this->connect($this->buttonBox, SIGNAL("accepted()"), $this, SLOT("accept()"));
     $this->connect($this->buttonBox, SIGNAL("rejected()"), $this, SLOT("reject()"));
     $mainLayout = new QVBoxLayout();
     $mainLayout->addWidget($this->tabWidget);
     $mainLayout->addWidget($this->buttonBox);
     $this->setLayout($mainLayout);
     $this->setWindowTitle(tr("Tab Dialog"));
 }
Example #18
0
 public function __construct(&$designer, $parent = 0)
 {
     if ($parent == 0) {
         parent::__construct();
     } else {
         parent::__construct($parent);
     }
     $this->designer = $designer;
     $this->layout = new QVBoxLayout();
     $this->layout->margin = 1;
     $this->layout->spacing = 0;
     $this->stack = new QStackedWidget($this);
     $this->stack->lineWidth = 0;
     $this->stack->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred, QSizePolicy::TabWidget);
     $this->stack->setFrameShape(QFrame::StyledPanel);
     $this->stack->objectName = '___pq_creator__pqtabwidget_stack_';
     $this->styleSheet = '#___pq_creator__pqtabwidget_stack_ { margin-top:-2px; background:#fff; }';
     $this->tabbar = new QTabBar($this);
     $this->tabbar->expanding = false;
     $this->tabbar->connect(SIGNAL('currentChanged(int)'), $this, SLOT('setActiveStackIndex(int)'));
     $this->setLayout($this->layout);
     $this->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding, QSizePolicy::TabWidget);
     $this->layout->addWidget($this->tabbar);
     $this->layout->addWidget($this->stack);
 }
Example #19
0
 private function createRootItemWidget($property, $object, $tree, $itemIndex)
 {
     $widget = null;
     switch ($property['type']) {
         case 'mixed':
         case 'int':
             $widget = new QLineEdit();
             if (isset($property['value']) && !$defaultPropertiesLoaded) {
                 $widget->text = $property['value'];
             } else {
                 $widget->text = $object->{$property}['property'];
             }
             // set validator if section exists
             if (isset($property['validator'])) {
                 $widget->setRegExpValidator($property['validator']);
             } else {
                 // if property type is `int` and validator section not exists,
                 // then set a default validator for integers
                 if ($property['type'] == 'int') {
                     $widget->setRegExpValidator('[0-9]*');
                 }
             }
             $widget->connect(SIGNAL('textChanged(QString)'), $this, SLOT('setObjectProperty(QString)'));
             break;
         case 'bool':
             $widget = new QCheckBox();
             if (isset($property['value']) && !$defaultPropertiesLoaded) {
                 $widget->checked = $property['value'];
             } else {
                 $widget->checked = $object->{$property}['property'];
             }
             $widget->connect(SIGNAL('toggled(bool)'), $this, SLOT('setObjectProperty(bool)'));
             break;
         case 'combo-list':
             foreach ($property['list'] as $listItemProperty) {
                 $childItemIndex = $tree->addItem($itemIndex, $listItemProperty['title']);
                 $childItemWidget = $this->createRootItemWidget($listItemProperty, $object, $tree, $itemIndex);
                 if ($childItemWidget != null) {
                     $childItemWidget->__pq_property_ = $property['property'];
                     $childItemWidget->__pq_propertyType_ = $property['type'];
                     $childItemWidget->objectName = "__pq_property_combo_" . $property['property'] . "_" . $listItemProperty['property'];
                     $tree->setItemWidget($childItemIndex, 1, $childItemWidget);
                 }
             }
             break;
         case 'combo':
             $widget = new QComboBox();
             if (isset($property['list']) && is_array($property['list'])) {
                 $index = 0;
                 foreach ($property['list'] as $list) {
                     if (isset($list['title']) && isset($list['value'])) {
                         $cPropertyValue = "cPropertyValue_{$index}";
                         $qvalue = "__pq_property_qvalue_{$index}";
                         $widget->addItem($list['title']);
                         $widget->{$cPropertyValue} = $list['value'];
                         $widget->{$qvalue} = $list['qvalue'];
                         if (isset($property['defaultIndex'])) {
                             $widget->currentIndex = $property['defaultIndex'];
                         }
                         $index++;
                     }
                 }
             }
             $widget->connect(SIGNAL('currentIndexChanged(int)'), $this, SLOT('setObjectProperty(int)'));
             break;
     }
     return $widget;
 }
Example #20
0
 public function createActions()
 {
     $this->minimizeAction = new QAction($this->tr("Mi&nimize"), $this);
     $this->connect($this->minimizeAction, SIGNAL("triggered()"), $this, SLOT("hide()"));
     /*
             $this->maximizeAction = new QAction($this->tr("Ma&ximize"), $this);
             QObject::connect($this->maximizeAction,
                    SIGNAL("triggered()"), $this,
                    SLOT("showMaximized()"));
     */
     $this->restoreAction = new QAction($this->tr("&Restore"), $this);
     $this->connect($this->restoreAction, SIGNAL("triggered()"), $this, SLOT("showNormal()"));
     /*
             $this->quitAction = new QAction($this->tr("&Quit"), $this);
     		QObject::connect($this->quitAction, SIGNAL("triggered()"),
                     new QApplication(), SLOT("quit()"));
     */
 }
Example #21
0
<?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();
 public function __construct()
 {
     parent::__construct();
     $this->button = new QPushButton(tr("quit"), $this);
     $this->connect($this->button, SIGNAL('clicked()'), QCoreApplication::instance(), SLOT('quit()'));
 }