bool QLCDNumber::qt_invoke( int _id, QUObject* _o ) { switch ( _id - staticMetaObject()->slotOffset() ) { case 0: display((const QString&)static_QUType_QString.get(_o+1)); break; case 1: display((int)static_QUType_int.get(_o+1)); break; case 2: display((double)static_QUType_double.get(_o+1)); break; case 3: setHexMode(); break; case 4: setDecMode(); break; case 5: setOctMode(); break; case 6: setBinMode(); break; case 7: setSmallDecimalPoint((bool)static_QUType_bool.get(_o+1)); break; default: return QFrame::qt_invoke( _id, _o ); } return TRUE; }
MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow) { ui->setupUi(this); //вывод ошибок в log connect(&port,SIGNAL(error(QString)),this,SLOT(printErrorMessage(QString))); connect(ui->send_pushButton,SIGNAL(clicked()),this,SLOT(sendMessage())); connect(ui->run_button,SIGNAL(clicked()),this,SLOT(runScript())); connect(ui->comPort_comboBox,SIGNAL(currentTextChanged(QString)),&port,SLOT(serialPortChanged(QString))); //получение списка всех портов и добавление их в comPort_comboBox foreach (const QSerialPortInfo &info, QSerialPortInfo::availablePorts()) ui->comPort_comboBox->addItem(info.portName(),Qt::DisplayRole); //привязка изменения настроек в интерфейсе к сетерам connect(ui->bitsRate_comboBox,SIGNAL(currentTextChanged(QString)),&port,SLOT(baudRateChanged(QString))); connect(ui->parity__comboBox,SIGNAL(currentTextChanged(QString)),&port,SLOT(parityChanged(QString))); connect(ui->dataBits_comboBox,SIGNAL(currentTextChanged(QString)),&port,SLOT(dataBitsChanged(QString))); connect(ui->stopBits_comboBox,SIGNAL(currentTextChanged(QString)),&port,SLOT(stopBitsChanged(QString))); connect(ui->flowControl_comboBox,SIGNAL(currentTextChanged(QString)),&port,SLOT(flowControlChanged(QString))); connect(ui->comPort_comboBox,SIGNAL(currentTextChanged(QString)),this,SLOT(setDefault(QString))); //ввывод ошибок в log connect(&port,SIGNAL(error(QSerialPort::SerialPortError)),this,SLOT(error(QSerialPort::SerialPortError))); //добавление в всех возможных вариантов настроек в интерфейс ui->bitsRate_comboBox->addItems(comPortSettings::bitsRates); ui->dataBits_comboBox->addItems(comPortSettings::dataBits); ui->parity__comboBox->addItems(comPortSettings::parityBits); ui->stopBits_comboBox->addItems(comPortSettings::stopBits); ui->flowControl_comboBox->addItems(comPortSettings::flowControl); setDefault(""); QFileDialog* fileDialog = new QFileDialog(this,QString("Open Script"),QString(""),QString("*.txt")); connect(ui->open_button, SIGNAL(clicked()), fileDialog, SLOT(open())); //TODO: роскоментить в финальном варианте (а то система тормозит) connect(fileDialog, SIGNAL(fileSelected(QString)), ui->filePath_lineEdit, //поєднання підтверження вибору файлу та завантаження SLOT(setText(QString))); //привязка действий к кнопкам выбора режима connect(ui->hex_radioButton,SIGNAL(clicked()),this,SLOT(setHexMode())); connect(ui->text_radioButton,SIGNAL(clicked()),this,SLOT(setTextMode())); emit ui->hex_radioButton->clicked(); //слушаем порт connect(&port,SIGNAL(readData(QString)),this,SLOT(printReceivedMessage(QString))); loadSettings(); }
int QLCDNumber::qt_metacall(QMetaObject::Call _c, int _id, void **_a) { _id = QFrame::qt_metacall(_c, _id, _a); if (_id < 0) return _id; if (_c == QMetaObject::InvokeMetaMethod) { switch (_id) { case 0: overflow(); break; case 1: display((*reinterpret_cast< const QString(*)>(_a[1]))); break; case 2: display((*reinterpret_cast< int(*)>(_a[1]))); break; case 3: display((*reinterpret_cast< double(*)>(_a[1]))); break; case 4: setHexMode(); break; case 5: setDecMode(); break; case 6: setOctMode(); break; case 7: setBinMode(); break; case 8: setSmallDecimalPoint((*reinterpret_cast< bool(*)>(_a[1]))); break; default: ; } _id -= 9; } #ifndef QT_NO_PROPERTIES else if (_c == QMetaObject::ReadProperty) { void *_v = _a[0]; switch (_id) { case 0: *reinterpret_cast< bool*>(_v) = smallDecimalPoint(); break; case 1: *reinterpret_cast< int*>(_v) = numDigits(); break; case 2: *reinterpret_cast< int*>(_v) = digitCount(); break; case 3: *reinterpret_cast< Mode*>(_v) = mode(); break; case 4: *reinterpret_cast< SegmentStyle*>(_v) = segmentStyle(); break; case 5: *reinterpret_cast< double*>(_v) = value(); break; case 6: *reinterpret_cast< int*>(_v) = intValue(); break; } _id -= 7; } else if (_c == QMetaObject::WriteProperty) { void *_v = _a[0]; switch (_id) { case 0: setSmallDecimalPoint(*reinterpret_cast< bool*>(_v)); break; case 1: setNumDigits(*reinterpret_cast< int*>(_v)); break; case 2: setDigitCount(*reinterpret_cast< int*>(_v)); break; case 3: setMode(*reinterpret_cast< Mode*>(_v)); break; case 4: setSegmentStyle(*reinterpret_cast< SegmentStyle*>(_v)); break; case 5: display(*reinterpret_cast< double*>(_v)); break; case 6: display(*reinterpret_cast< int*>(_v)); break; } _id -= 7; } else if (_c == QMetaObject::ResetProperty) { _id -= 7; } else if (_c == QMetaObject::QueryPropertyDesignable) { _id -= 7; } else if (_c == QMetaObject::QueryPropertyScriptable) { _id -= 7; } else if (_c == QMetaObject::QueryPropertyStored) { _id -= 7; } else if (_c == QMetaObject::QueryPropertyEditable) { _id -= 7; } else if (_c == QMetaObject::QueryPropertyUser) { _id -= 7; } #endif // QT_NO_PROPERTIES return _id; }