Beispiel #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();
 }
Beispiel #2
0
 private function createButtonsLayout()
 {
     $this->newScreenshotButton = $this->createButton(tr("New Screenshot"), $this, SLOT("newScreenshot()"));
     $this->saveScreenshotButton = $this->createButton(tr("Save Screenshot"), $this, SLOT("saveScreenshot()"));
     $this->quitScreenshotButton = $this->createButton(tr("Quit"), $this, SLOT("close()"));
     $this->buttonsLayout = new QHBoxLayout();
     $this->buttonsLayout->addStretch();
     $this->buttonsLayout->addWidget($this->newScreenshotButton);
     $this->buttonsLayout->addWidget($this->saveScreenshotButton);
     $this->buttonsLayout->addWidget($this->quitScreenshotButton);
 }
Beispiel #3
0
 public function createIconGroupBox()
 {
     $this->iconGroupBox = new QGroupBox($this->tr("Tray Icon"));
     $this->iconLabel = new QLabel("Icon:");
     $this->iconComboBox = new QComboBox();
     $this->iconComboBox->addItem(new QIcon("./images/bad.svg"), $this->tr("Bad"));
     $this->iconComboBox->addItem(new QIcon("./images/heart.svg"), $this->tr("Heart"));
     $this->iconComboBox->addItem(new QIcon("./images/trash.svg"), $this->tr("Trash"));
     $this->showIconCheckBox = new QCheckBox($this->tr("Show icon"));
     $this->showIconCheckBox->setChecked(True);
     $iconLayout = new QHBoxLayout();
     $iconLayout->addWidget($this->iconLabel);
     $iconLayout->addWidget($this->iconComboBox);
     $iconLayout->addStretch();
     $iconLayout->addWidget($this->showIconCheckBox);
     $this->iconGroupBox->setLayout($iconLayout);
 }