void QCPInp::showSettingsDlg() { QStringList items; items << "!default" << "dsp0" << "dsp1" << "dsp2" << "dsp3" << "dsp4" << "dsp5" << "dsp6" << "dsp7"; int c=0; if (!(items.contains(dspNum))) { items << dspNum; c=items.count()-1; } else c=items.indexOf(QRegExp(dspNum)); bool ok; QString item = QInputDialog::getItem(this, tr("DSP input device"), tr("User-land device number"), items, c, true, &ok); if (ok && !item.isEmpty()) { dspNum=item; for (int i=0;i<cpOwner->children().count();i++) if (QCPInp *base=qobject_cast<QCPInp*>(cpOwner->children().at(i))) if ((base->objectName()!=objectName()) && (base->dspNum==dspNum)) { QMessageBox::warning(0,tr("Duplicated DSP"),tr("You have entered duplicated identifier for this DSP input,\nthat is already used in another component.\nPlease, recheck your DSP inputs!")); break; } update(); emit componentChanged(this); } }
void QCPBase::mouseReleaseEvent(QMouseEvent * event) { if (fSettingsDlg) { fSettingsDlg=false; return; } QPoint mx=mapToGlobal(event->pos()); QCPBase* dFlt; int pNum,pType; mouseInPin(mx,pNum,pType,dFlt); if (pNum==-1) { bool f=isDragging; isDragging=false; if (!f) cpOwner->doneConnBuilder(true,QPT_INPUT,-1,0,0); else checkRecycle(); isDragging=f; return; } if (pType==QPT_INPUT) cpOwner->doneConnBuilder(false,QPT_INPUT,pNum,dFlt->fInputs[pNum],0); else cpOwner->doneConnBuilder(false,QPT_OUTPUT,pNum,0,dFlt->fOutputs[pNum]); emit componentChanged(this); }
void QCPBase::mousePressEvent(QMouseEvent * event) { raise(); if (event->button()==Qt::RightButton) { fSettingsDlg=true; showSettingsDlg(); fSettingsDlg=false; return; } QPoint mx=mapToGlobal(event->pos()); QCPBase* dFlt; int pNum,pType; mouseInPin(mx,pNum,pType,dFlt); emit componentChanged(this); if (pNum==-1) { relCorner=event->pos(); isDragging=true; return; } isDragging=false; if (pType==QPT_INPUT) cpOwner->initConnBuilder(QPT_INPUT,pNum,dFlt->fInputs[pNum],0); else cpOwner->initConnBuilder(QPT_OUTPUT,pNum,0,dFlt->fOutputs[pNum]); }
void RKComponent::changed () { RK_TRACE (PLUGIN); if (parentComponent ()) { parentComponent ()->changed (); } emit (componentChanged (this)); }
void QCPBase::mouseMoveEvent(QMouseEvent * event) { // if (event->button()==Qt::LeftButton) if (isDragging) { move(QPoint(x()+event->x()-relCorner.x(),y()+event->y()-relCorner.y())); cpOwner->repaintConn(); cpOwner->resize(cpOwner->minimumSizeHint()); update(); emit componentChanged(this); } else cpOwner->refreshConnBuilder(event->pos()); }
void ComponentWidget::selectComponent(QAction *action) { if (m_component == InvalidComponent) { m_componentUi.componentButton->setMinimumWidth(m_componentUi.componentButton->menu()->width()); m_componentUi.insertButton->setEnabled(true); emit componentChanged(true); } m_component = static_cast<ClockComponent>(action->data().toInt()); m_options.clear(); m_componentUi.componentButton->setText(action->text()); m_componentUi.optionsButton->menu()->clear(); if (m_component == SecondComponent || m_component == MinuteComponent || m_component == HourComponent || m_component == DayOfWeekComponent || m_component == DayOfMonthComponent || m_component == DayOfYearComponent || m_component == WeekComponent || m_component == MonthComponent || m_component == YearComponent || m_component == TimeComponent || m_component == DateComponent || m_component == DateTimeComponent || m_component == HolidaysComponent || m_component == EventsComponent) { QCheckBox *checkBox = new QCheckBox(i18n("Short Form"), m_componentUi.optionsButton->menu()); addOption(checkBox); connect(checkBox, SIGNAL(toggled(bool)), this, SLOT(setShortForm(bool))); }