Beispiel #1
0
void Window_Tips::onBtnEvent(Ref* sender,Widget::TouchEventType type){
    Widget* btn = dynamic_cast<Widget*>(sender);
    if (btn==nullptr) {
        return;
    }
    switch (type) {
        case cocos2d::ui::Widget::TouchEventType::BEGAN:
            if (dynamic_cast<ImageView*>(sender)!=nullptr) {
                PopBtn(btn);
            }
            break;
        case cocos2d::ui::Widget::TouchEventType::ENDED:
            switch (btn->getTag()) {
                case BTN_OK:
                    onCloseClick();
                    break;
                case BTN_CLOSE:
                    onCloseClick();
                    break;
                default:
                    break;
            }
            break;
            
        default:
            break;
    }
}
MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
{
    ui->setupUi(this);

    connect(ui->refreshPortsButton, SIGNAL(clicked()), this, SLOT(onRefreshPortsClick()));
    connect(ui->connectButton, SIGNAL(clicked()), this, SLOT(onConnectClick()));
    connect(ui->closeButton, SIGNAL(clicked()), this, SLOT(onCloseClick()));
    connect(ui->sendButton, SIGNAL(clicked()), this, SLOT(onSendClick()));
    connect(ui->sendLineEdit, SIGNAL(textChanged(QString)), this, SLOT(onTextChanged(QString)));

    connect(&m_serialPort, SIGNAL(readyRead()), this, SLOT(onReadData()));
    connect(&m_serialPort, SIGNAL(error(QSerialPort::SerialPortError)), this, SLOT(onError(QSerialPort::SerialPortError)));
}