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(); }
function testObjectBack() { echo "\ntesting getting object back"; $this->assertEquals(is_object(QApplication::instance()), true, "Could not fetch instance of QApplication!"); // we need this, otherwise ZE would destroy $app too early QTimer::singleShot(100, QApplication::instance(), SLOT("quit()")); echo " passed"; }
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()')); }
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)')); }
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); }
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); }
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(); }