Пример #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();
 }
Пример #2
0
 public function __construct()
 {
     parent::__construct();
     $this->currentAngle = 45;
     $this->setPalette(new QPalette(new QColor(250, 250, 200)));
     $this->setAutoFillBackground(true);
 }
Пример #3
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()'));
 }
Пример #4
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);
 }
Пример #5
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);
 }
Пример #6
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);
 }
Пример #7
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);
 }
Пример #8
0
 public function __construct()
 {
     parent::__construct();
     $this->screenshotLabel = new QLabel();
     $this->screenshotLabel->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
     $this->screenshotLabel->setAlignment(Qt::AlignCenter);
     $this->screenshotLabel->setMinimumSize(240, 160);
     $this->createOptionsGroupBox();
     $this->createButtonsLayout();
     $this->mainLayout = new QVBoxLayout();
     $this->mainLayout->addWidget($this->screenshotLabel);
     $this->mainLayout->addWidget($this->optionsGroupBox);
     $this->mainLayout->addLayout($this->buttonsLayout);
     $this->setLayout($this->mainLayout);
     $this->shootScreen();
     $this->delaySpinBox->setValue(5);
     $this->setWindowTitle(tr("Screenshot"));
     $this->resize(300, 200);
 }
Пример #9
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();
 }
Пример #10
0
 public function __construct()
 {
     parent::__construct();
     $this->createIconGroupBox();
     $this->createMessageGroupBox();
     $this->iconLabel->setMinimumWidth($this->durationLabel->sizeHint()->width());
     $this->createActions();
     $this->createTrayIcon();
     $this->connect($this->showMessageButton, SIGNAL("clicked()"), $this, SLOT("showMessage()"));
     $this->connect($this->iconComboBox, SIGNAL("currentIndexChanged(int)"), $this, SLOT("setIcon(int)"));
     $this->connect($this->showIconCheckBox, SIGNAL("toggled(bool)"), $this->trayIcon, SLOT("setVisible(bool)"));
     $this->connect($this->trayIcon, SIGNAL("messageClicked()"), $this, SLOT("messageClicked()"));
     $this->connect($this->trayIcon, SIGNAL("activated(QSystemTrayIcon::ActivationReason)"), $this, SLOT("iconActivated(QSystemTrayIcon::ActivationReason)"));
     $mainLayout = new QVBoxLayout();
     $mainLayout->addWidget($this->iconGroupBox);
     $mainLayout->addWidget($this->messageGroupBox);
     $this->setLayout($mainLayout);
     $this->iconComboBox->setCurrentIndex(1);
     $this->trayIcon->show();
     $this->setWindowTitle($this->tr("Systray"));
     $this->resize(400, 300);
 }
Пример #11
0
 public function __construct()
 {
     parent::__construct();
     $this->layout = new QVBoxLayout($this);
     // Load the test xml
     $unicodeXml = new DOMDocument();
     $unicodeXml->load("unicode.xml");
     $xpath = new DOMXPath($unicodeXml);
     $dataNodes = $xpath->query("/test/data");
     // Loop on all data node and create buttons
     foreach ($dataNodes as $data) {
         $this->buttons[] = new QLineEdit(QString::fromUtf8($data->nodeValue, -1), $this);
         foreach ($data->attributes as $attribute) {
             $this->layout->addWidget(new QLabel($attribute->name . ": " . $attribute->value));
         }
         $this->layout->addWidget($this->buttons[count($this->buttons) - 1]);
     }
     $this->buttons[] = new QLineEdit("Test", $this);
     $this->layout->addWidget($this->buttons[count($this->buttons) - 1]);
     $this->buttons[] = new QLineEdit("second Test", $this);
     $this->layout->addWidget($this->buttons[count($this->buttons) - 1]);
 }
Пример #12
0
 public function __construct(QFileInfo $fileInfo, QWidget $parent = NULL)
 {
     parent::__construct($parent);
     $topLabel = new QLabel(tr("Open with:"));
     $applicationsListBox = new QListWidget();
     $applications = array();
     for ($i = 1; $i <= 30; ++$i) {
         $applications[] = tr("Application %1")->arg($i);
     }
     $applicationsListBox->insertItems(0, $applications);
     $alwaysCheckBox = new QCheckBox();
     if ($fileInfo->suffix()->isEmpty()) {
         $alwaysCheckBox = new QCheckBox(tr("Always use this application to " . "open this type of file"));
     } else {
         $alwaysCheckBox = new QCheckBox(tr("Always use this application to " . "open files with the extension '%1'") . arg($fileInfo->suffix()));
     }
     $layout = new QVBoxLayout();
     $layout->addWidget($topLabel);
     $layout->addWidget($applicationsListBox);
     $layout->addWidget($alwaysCheckBox);
     $this->setLayout($layout);
 }
Пример #13
0
 function __construct()
 {
     parent::__construct();
     $this->pendingAdditiveOperator = new QString();
     $this->pendingMultiplicativeOperator = new QString();
     $this->display = new QLineEdit("0");
     $this->display->setReadOnly(true);
     $this->display->setAlignment(Qt::AlignRight);
     $this->display->setMaxLength(15);
     $this->display->installEventFilter($this);
     $font = $this->display->font();
     $font->setPointSize($font->pointSize() + 8);
     $this->display->setFont($font);
     $digitColor = new QColor(150, 205, 205);
     $backspaceColor = new QColor(225, 185, 135);
     $memoryColor = new QColor(100, 155, 155);
     $operatorColor = new QColor(155, 175, 195);
     for ($i = 0; $i < Calculator::NumDigitButtons; ++$i) {
         $this->digitButtons[$i] = $this->createButton(tr($i), $digitColor, SLOT('digitClicked()'));
     }
     $this->pointButton = $this->createButton(tr("."), $digitColor, SLOT('pointClicked()'));
     $this->changeSignButton = $this->createButton(tr("±"), $digitColor, SLOT('changeSignClicked()'));
     $this->backspaceButton = $this->createButton(tr("Backspace"), $backspaceColor, SLOT('backspaceClicked()'));
     $this->clearButton = $this->createButton(tr("Clear"), $backspaceColor, SLOT('clear()'));
     $this->clearAllButton = $this->createButton(tr("Clear All"), $backspaceColor, SLOT('clearAll()'));
     $this->clearMemoryButton = $this->createButton(tr("MC"), $memoryColor, SLOT('clearMemory()'));
     $this->readMemoryButton = $this->createButton(tr("MR"), $memoryColor, SLOT('read_Memory()'));
     $this->setMemoryButton = $this->createButton(tr("MS"), $memoryColor, SLOT('setMemory()'));
     $this->addToMemoryButton = $this->createButton(tr("M+"), $memoryColor, SLOT('addToMemory()'));
     $this->divisionButton = $this->createButton(tr("÷"), $operatorColor, SLOT('multiplicativeOperatorClicked()'));
     $this->timesButton = $this->createButton(tr("×"), $operatorColor, SLOT('multiplicativeOperatorClicked()'));
     $this->minusButton = $this->createButton(tr("-"), $operatorColor, SLOT('additiveOperatorClicked()'));
     $this->plusButton = $this->createButton(tr("+"), $operatorColor, SLOT('additiveOperatorClicked()'));
     $this->squareRootButton = $this->createButton(tr("Sqrt"), $operatorColor, SLOT('unaryOperatorClicked()'));
     $this->powerButton = $this->createButton(tr("x²"), $operatorColor, SLOT('unaryOperatorClicked()'));
     $this->reciprocalButton = $this->createButton(tr("1/x"), $operatorColor, SLOT('unaryOperatorClicked()'));
     $this->equalButton = $this->createButton(tr("="), $operatorColor, SLOT('equalClicked()'));
     $this->mainLayout = new QGridLayout();
     $this->mainLayout->setSizeConstraint(QLayout::SetFixedSize);
     $this->mainLayout->addWidget($this->display, 0, 0, 1, 6);
     $this->mainLayout->addWidget($this->backspaceButton, 1, 0, 1, 2);
     $this->mainLayout->addWidget($this->clearButton, 1, 2, 1, 2);
     $this->mainLayout->addWidget($this->clearAllButton, 1, 4, 1, 2);
     $this->mainLayout->addWidget($this->clearMemoryButton, 2, 0);
     $this->mainLayout->addWidget($this->readMemoryButton, 3, 0);
     $this->mainLayout->addWidget($this->setMemoryButton, 4, 0);
     $this->mainLayout->addWidget($this->addToMemoryButton, 5, 0);
     for ($i = 1; $i < Calculator::NumDigitButtons; ++$i) {
         $row = ceil((8 - ($i + 1)) / 3) + 2;
         $column = ceil(($i - 1) % 3) + 1;
         $this->mainLayout->addWidget($this->digitButtons[$i], (int) $row, (int) $column);
     }
     $this->mainLayout->addWidget($this->digitButtons[0], 5, 1);
     $this->mainLayout->addWidget($this->pointButton, 5, 2);
     $this->mainLayout->addWidget($this->changeSignButton, 5, 3);
     $this->mainLayout->addWidget($this->divisionButton, 2, 4);
     $this->mainLayout->addWidget($this->timesButton, 3, 4);
     $this->mainLayout->addWidget($this->minusButton, 4, 4);
     $this->mainLayout->addWidget($this->plusButton, 5, 4);
     $this->mainLayout->addWidget($this->squareRootButton, 2, 5);
     $this->mainLayout->addWidget($this->powerButton, 3, 5);
     $this->mainLayout->addWidget($this->reciprocalButton, 4, 5);
     $this->mainLayout->addWidget($this->equalButton, 5, 5);
     $this->setLayout($this->mainLayout);
     $this->setWindowTitle(tr("Calculator"));
 }
Пример #14
0
 public function __construct()
 {
     parent::__construct();
     $this->iconsPath = c(PQNAME)->iconsPath;
     $openProject = $this->create_button(tr('Open project'), 'open.png', '', false);
     $qwidgetProject = $this->create_button(tr('Qt QWidget application'), 'widget.png', SLOT('new_QWidget_project()'));
     $qmainwindowProject = $this->create_button(tr('Qt QMainWindow application'), 'window.png', SLOT('new_QMainWindow_project()'));
     $consoleProject = $this->create_button(tr('Console application'), 'console.png', '', false);
     $silentProject = $this->create_button(tr('Hidden application'), 'hidden.png', '', false);
     //$label1 = new QLabel($this);
     //$label1->text = tr('Open project');
     $label2 = new QLabel($this);
     $label2->text = tr('New project');
     $label2->styleSheet = 'font-weight:bold;font-size:12px;margin-bottom:4px;margin-left:-2px;';
     $hline = new QFrame($this);
     $hline->frameShape = QFrame::HLine;
     $hline->frameShadow = QFrame::Raised;
     $newProject = new QWidget($this);
     // NewProject name
     $newProjectName_label = new QLabel($newProject);
     $newProjectName_label->text = tr('Project name:');
     $newProjectName_label->styleSheet = 'margin-left:1px;';
     $newProjectName_lineEdit = new QLineEdit($newProject);
     $newProjectName_lineEdit->text = $this->get_def_project_name();
     $newProjectName_lineEdit->setRegExpValidator('[a-zA-Z0-9\\-\\_]*');
     $this->newProjectName_lineEdit = $newProjectName_lineEdit;
     // NewProject FileDialog
     $newProjectFD_label = new QLabel($newProject);
     $newProjectFD_label->text = tr('Create in:');
     $newProjectFD_label->styleSheet = 'margin-left:1px;';
     $newProjectFD_lineEdit = new QLineEdit($newProject);
     $newProjectFD_lineEdit->readOnly = true;
     $newProjectFD_lineEdit->text = $this->get_def_dir();
     $newProjectFD_button = new QPushButton($newProject);
     $newProjectFD_button->text = tr('View...');
     $newProjectFD_button->connect(SIGNAL('clicked()'), $this, SLOT('open_newProjectFD()'));
     // NewProject layout
     $newProject_layout = new QGridLayout();
     $newProject_layout->setMargin(0);
     $newProject_layout->addWidget($newProjectName_label, 0, 0);
     $newProject_layout->addWidget($newProjectName_lineEdit, 0, 1, 1, 2);
     $newProject_layout->addWidget(new QWidget($newProject), 1, 1, 1, 3);
     // Empty widget uses as small spacer
     $newProject_layout->addWidget($newProjectFD_label, 2, 0);
     $newProject_layout->addWidget($newProjectFD_lineEdit, 2, 1);
     $newProject_layout->addWidget($newProjectFD_button, 2, 2);
     $newProject->setLayout($newProject_layout);
     $this->newProjectFD = new QFileDialog();
     $this->newProjectFD_lineEdit = $newProjectFD_lineEdit;
     $emptyw0 = new QWidget($this);
     $emptyw0->minimumHeight = 8;
     $emptyw0->maximumHeight = 8;
     $layout = new QGridLayout();
     $layout->addWidget($openProject, 1, 0, 1, 2);
     $layout->addWidget($hline, 2, 0, 1, 2);
     $layout->addWidget($label2, 3, 0, 1, 2);
     $layout->addWidget($newProject, 4, 0, 1, 2);
     $layout->addWidget($emptyw0, 5, 0, 1, 2);
     $layout->addWidget($qwidgetProject, 6, 0);
     $layout->addWidget($qmainwindowProject, 6, 1);
     $layout->addWidget($consoleProject, 7, 0);
     $layout->addWidget($silentProject, 7, 1);
     $this->minimumWidth = 500;
     $this->windowFlags = Qt::Dialog | Qt::MSWindowsFixedSizeDialogHint;
     $this->setLayout($layout);
     $this->windowTitle = 'PQCreator';
 }
Пример #15
0
 public function __construct()
 {
     parent::__construct();
 }
Пример #16
0
 public function __construct()
 {
     parent::__construct();
     $this->button = new QPushButton(tr("quit"), $this);
     $this->connect($this->button, SIGNAL('clicked()'), QCoreApplication::instance(), SLOT('quit()'));
 }
Пример #17
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);
 }