void PositionParameterDefinition::buildEditors(Script *script, QWidget *parent) { ParameterDefinition::buildEditors(script, parent); mPositionEdit = new PositionEdit(parent); connect(mPositionEdit, SIGNAL(positionChosen(QPointF)), this, SLOT(positionChosen(QPointF))); addEditor(mPositionEdit); mPositionUnitComboBox = new QComboBox(parent); mPositionUnitComboBox->addItems(QStringList() << tr("pixels") << tr("percents")); addEditor(mPositionUnitComboBox); }
void ColorPositionParameterDefinition::buildEditors(Script *script, QWidget *parent) { ParameterDefinition::buildEditors(script, parent); mPositionEdit = new PositionEdit(parent); addEditor(mPositionEdit); mColorEdit = new ColorEdit(parent); mColorEdit->setChooseByPositionButtonVisible(false); addEditor(mColorEdit); connect(mPositionEdit, SIGNAL(positionChosen(QPointF)), mColorEdit, SLOT(setPosition(QPointF)), Qt::QueuedConnection); connect(mColorEdit, SIGNAL(positionChosen(QPointF)), mPositionEdit, SLOT(setPosition(QPointF)), Qt::QueuedConnection); }
void ChoosePositionPushButton::mouseReleaseEvent(QMouseEvent *event) { QPushButton::mouseReleaseEvent(event); emit positionChosen(event->globalPos()); stopMouseCapture(); }
PointListWidget::PointListWidget(QWidget *parent) : QWidget(parent), ui(new Ui::PointListWidget) { ui->setupUi(this); setMinimumHeight(250); updateClearStatus(); on_list_itemSelectionChanged(); delete ui->list->itemDelegate(); ui->list->setItemDelegate(new PointItemDelegate(this)); connect(ui->addPositionPushButton, SIGNAL(positionChosen(QPointF)), this, SLOT(positionChosen(QPointF)), Qt::QueuedConnection); connect(ui->capturePathPushButton, SIGNAL(positionChosen(QPointF)), this, SLOT(stopCapture()), Qt::QueuedConnection); connect(&mCaptureTimer, SIGNAL(timeout()), this, SLOT(capture())); }
bool ChoosePositionPushButton::x11EventFilter(XEvent *event) { if(event->type == ButtonRelease) { emit positionChosen(QCursor::pos()); stopMouseCapture(); return true; } return false; }
bool ChoosePositionPushButton::nativeEventFilter(const QByteArray &eventType, void *message, long *) { if(eventType == "xcb_generic_event_t") { auto* event = static_cast<xcb_generic_event_t *>(message); switch(event->response_type) { case XCB_BUTTON_RELEASE: emit positionChosen(QCursor::pos()); stopMouseCapture(); return false; } return false; } return false; }
void ColorEdit::on_chooseByPosition_positionChosen(QPoint position) { setPosition(position); emit positionChosen(position); }
void PositionEdit::on_choose_positionChosen(QPointF position) { setPosition(position); emit positionChosen(position); }