/* * Connect a Qt signal or a Python signal to a Qt slot, a Qt signal, a Python * slot or a Python signal. This is all possible combinations. */ PyObject *sip_api_connect_rx(PyObject *txObj, const char *sig, PyObject *rxObj, const char *slot, int type) { /* Handle Qt signals. */ if (isQtSignal(sig)) { void *tx, *rx; const char *member, *real_sig; int res; if ((tx = sip_api_get_cpp_ptr((sipSimpleWrapper *)txObj, sipQObjectType)) == NULL) return NULL; real_sig = sig; if ((tx = newSignal(tx, &real_sig)) == NULL) return NULL; if ((rx = sip_api_convert_rx((sipWrapper *)txObj, sig, rxObj, slot, &member, 0)) == NULL) return NULL; res = sipQtSupport->qt_connect(tx, real_sig, rx, member, type); return PyBool_FromLong(res); } /* Handle Python signals. Only PyQt3 will get this far. */ assert(sipQtSupport->qt_connect_py_signal); if (sipQtSupport->qt_connect_py_signal(txObj, sig, rxObj, slot) < 0) return NULL; Py_INCREF(Py_True); return Py_True; }
/* * Convert a Python receiver (either a Python signal or slot or a Qt signal or * slot) to a Qt receiver. It is only ever called when the signal is a Qt * signal. Return NULL is there was an error. */ void *sip_api_convert_rx(sipWrapper *txSelf, const char *sigargs, PyObject *rxObj, const char *slot, const char **memberp, int flags) { assert(sipQtSupport); if (slot == NULL) return createUniversalSlot(txSelf, sigargs, rxObj, NULL, memberp, flags); if (isQtSlot(slot) || isQtSignal(slot)) { void *rx; *memberp = slot; if ((rx = sip_api_get_cpp_ptr((sipSimpleWrapper *)rxObj, sipQObjectType)) == NULL) return NULL; if (isQtSignal(slot)) rx = newSignal(rx, memberp); return rx; } /* The slot is a Python signal so we need a universal slot to catch it. */ return createUniversalSlot(txSelf, sigargs, rxObj, slot, memberp, 0); }
void MainWindow::reportSlot() { //ReportFactory *rf = new ReportFactory(); //QWidget *report = rf->CreateReport(); QWidget *report = ReportFactory::CreateReport(); ui.scrollArea->setWidget(report); WidgetFactory::SetCurrentWidget(WidgetFactory::Report); //关闭报表 connect(report, SIGNAL(closeSignal()), this, SLOT(homeSlot())); //病案库 connect(report, SIGNAL(recordSignal()), this, SLOT(recordSlot())); //采集图像 connect(report, SIGNAL(cameraSignal()), this, SLOT(cameraSlot())); //处理图像 connect(report, SIGNAL(imageSignal()), this, SLOT(imageSlot())); //新建清空图片label connect(report, SIGNAL(newSignal()), this, SLOT(changeSlot())); FileCentre *fc = FileCentre::GetInstance(); QString path = fc->GetRecordPath(); changeSlot(path); }
void eaps8000UsbUICharWindow::setValues() { if( endOfLoop() ) { uiCharFinished(); if( _ui->chb_emitStopSignal->isChecked() ) { emit newSignal( SIGNAL_RECEIVER_ALL, SIGNAL_STOP, SIGNAL_CMD_VOID ); } return; } double setValue = (_ui->chb_calcValues->isChecked() ? _setUiValue : _lastMeasuredValue); _setUiValue = setValue + (_increasing ? 1 : -1)*_ui->dsb_stepSize->value(); if( _ui->cob_setValue->currentText() == VOLTAGE ) { if( _ui->cob_unit->currentText() == UNIT_MILLIVOLT ) { _setUiValue /= 1000.0; } _port.setValue( eaps8000UsbPort::setValueType::setTypeVoltage, _setUiValue, false ); } else if( _ui->cob_setValue->currentText() == CURRENT ) { if( _ui->cob_unit->currentText() == UNIT_MILLIAMPERE ) { _setUiValue /= 1000.0; } _port.setValue( eaps8000UsbPort::setValueType::setTypeCurrent, _setUiValue, false ); } }