Example #1
0
 public function createButton($component)
 {
     $componentsPath = $this->componentsPath;
     $componentPath = "{$componentsPath}/{$component}/component.php";
     $r = array();
     if (file_exists($componentPath) && is_file($componentPath)) {
         include $componentPath;
     } else {
         return;
     }
     if (!isset($r['group']) || $r['group'] == 'NoVisual') {
         return;
     }
     if (isset($r['parent']) && !empty(trim($r['parent']))) {
         $parentClass = $r['parent'];
     } else {
         $parentClass = null;
     }
     $objectName = isset($r['objectName']) ? "pqcreatebutton_{$component}_{$r[objectName]}" : "pqcreatebutton_{$component}_{$component}";
     $buttonText = isset($r['title']) ? $r['title'] : $component;
     $button = new QPushButton($this->componentsPanel);
     $button->objectName = $objectName;
     $button->text = $buttonText;
     $button->styleSheet = "text-align: left";
     $button->minimumHeight = 30;
     $button->icon = "{$componentsPath}/{$component}/icon.png";
     $button->flat = true;
     $button->creator = true;
     $button->setIconSize(24, 24);
     $button->parentClass = $parentClass;
     if (isset($r['defobjw']) && isset($r['defobjh'])) {
         $button->defobjw = $r['defobjw'];
         $button->defobjh = $r['defobjh'];
     }
     $button->connect(SIGNAL("mousePressed(int,int,int,int,int)"), $this, SLOT("createObject(int,int,int,int,int)"));
     $button->connect(SIGNAL("mouseMoved(int,int,int,int)"), $this, SLOT("moveObject(int,int,int,int)"));
     $button->connect(SIGNAL('mouseReleased(int,int,int,int,int)'), $this, SLOT('testCreate(int,int,int,int,int)'));
     $this->componentsLayout->addWidget($button);
 }
Example #2
0
 private function create_button($text, $icon, $slot = '', $enabled = true, $align = 'left')
 {
     $widget = new QWidget($this);
     $button = new QPushButton($widget);
     $button->text = $text;
     $button->setMinimumSize(200, 36);
     $button->enabled = $enabled;
     $button->styleSheet = "text-align:{$align};padding-left:50px;padding-right:20px;font-size:14px;";
     $label = new QLabel($widget);
     $label->icon = $this->iconsPath . "/{$icon}";
     $label->resize(32, 32);
     $label->enabled = $enabled;
     $label->move(10, 0);
     if (!empty($slot)) {
         $button->connect(SIGNAL('clicked(bool)'), $this, $slot);
         $label->connect(SIGNAL('mouseClicked()'), $button, SLOT('click()'));
     }
     $layout = new QHBoxLayout();
     $layout->setContentsMargins(0, 6, 0, 0);
     $layout->addWidget($button);
     $widget->setLayout($layout);
     return $widget;
 }
Example #3
0
 /**
  * @return QPushButton
  */
 private function createButton(QString $text, QWidget $receiver, $member)
 {
     $button = new QPushButton($text);
     $button->connect($button, SIGNAL("clicked()"), $receiver, (string) $member);
     return $button;
 }