示例#1
0
 public function __construct($parent = 0)
 {
     parent::__construct($parent);
     $this->setWindowFlags(Qt::Window);
     $this->textEdit = new PQPlainTextEdit($this);
     $this->headerLabel1 = new QLabel($this);
     $this->setPHPEventListener($this, eventListener);
     $this->addPHPEventListenerType(QEvent::Close);
     $buttonsPanel = new QWidget($this);
     $cancelBtn = new QPushButton($buttonsPanel);
     $cancelBtn->text = tr('Cancel');
     $cancelBtn->onClicked = function ($sender, $event) {
         $this->close();
     };
     $okBtn = new QPushButton($buttonsPanel);
     $okBtn->text = tr('OK');
     $okBtn->onClicked = function ($sender, $event) {
         $this->done(1);
     };
     $buttonsPanelLayout = new QHBoxLayout();
     $buttonsPanelLayout->addWidget(new QWidget($buttonsPanel));
     // распорка
     $buttonsPanelLayout->addWidget($cancelBtn);
     $buttonsPanelLayout->addWidget($okBtn);
     $buttonsPanelLayout->setMargin(0);
     $buttonsPanel->setLayout($buttonsPanelLayout);
     $layout = new QVBoxLayout();
     $layout->addWidget($this->headerLabel1);
     $layout->addWidget($this->textEdit);
     $layout->addWidget($buttonsPanel);
     $this->setLayout($layout);
 }
示例#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);
 }
示例#3
0
文件: main.php 项目: Shadrackn/php-qt
 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();
 }
示例#4
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);
 }
示例#5
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);
 }
示例#6
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);
 }
示例#7
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"));
 }
示例#8
0
 public function addTab($widget, &$codegen, $text, $icon = null)
 {
     $index = $this->tabbar->addTab($text);
     if ($icon != null) {
         $this->tabbar->setTabIcon($index, $icon);
     }
     $stackArea = new QWidget();
     $scrollArea_viewport = new QWidget();
     $scrollArea_viewport->setPalette("#ffffff");
     $scrollArea_viewport->objectName = '___pq_creator__pqtabwidget_scrollarea_viewport';
     $scrollArea_viewport->styleSheet = '#___pq_creator__pqtabwidget_scrollarea_viewport > QWidget { padding-top:2px; }';
     $scrollArea = new QScrollArea($stackArea);
     $scrollArea->objectName = '___pq_creator__pqtabwidget_scrollarea_';
     $scrollArea->setViewport($scrollArea_viewport);
     $scrollArea->setWidget($widget);
     $scrollArea->styleSheet = '#___pq_creator__pqtabwidget_scrollarea_ { border: none; }';
     $widget->resize(300, 300);
     $widget->isFormAreaWidget = true;
     $widget->tabIndex = $index;
     $stack = new QStackedWidget($stackArea);
     $stack->objectName = '___pq_creator__pqtabwidget_stackarea_stack_';
     $stack->addWidget($scrollArea);
     if ($codegen != null) {
         $stack->addWidget($codegen);
     }
     // $toolbar = $this->createToolBar($stackArea, $stack);
     $stackArea_layout = new QVBoxLayout();
     $stackArea_layout->setMargin(0);
     // $stackArea_layout->addWidget($toolbar);
     $stackArea_layout->addWidget($stack);
     $stackArea->setLayout($stackArea_layout);
     $this->stack->addWidget($stackArea);
 }