本文整理汇总了PHP中QApplication::instance方法的典型用法代码示例。如果您正苦于以下问题:PHP QApplication::instance方法的具体用法?PHP QApplication::instance怎么用?PHP QApplication::instance使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QApplication
的用法示例。
在下文中一共展示了QApplication::instance方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
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();
}
示例2: testObjectBack
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";
}
示例3: setupConnections
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)'));
}
示例4: __construct
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();
}