Changeset - 73e87165649b
[Not reviewed]
portlist
0 1 0
Hasan Yavuz Ă–ZDERYA - 10 years ago 2015-09-04 18:13:00
hy@ozderya.net
get port name from data role
1 file changed with 1 insertions and 1 deletions:
0 comments (0 inline, 0 general)
portcontrol.cpp
Show inline comments
 
@@ -220,25 +220,25 @@ void PortControl::togglePort()
 
    {
 
        // we get the port name from the edit text, which may not be
 
        // in the portList if user hasn't pressed Enter
 
        QString portName = ui->cbPortList->currentText();
 
        int portIndex = portList.indexOf(portName);
 
        if (portIndex < 0) // not in list, add to model and update the selections
 
        {
 
            portList.appendRow(new PortListItem(portName));
 
            ui->cbPortList->setCurrentIndex(portList.rowCount()-1);
 
            tbPortList.setCurrentIndex(portList.rowCount()-1);
 
        }
 

	
 
        serialPort->setPortName(portName);
 
        serialPort->setPortName(ui->cbPortList->currentData(PortNameRole).toString());
 

	
 
        // open port
 
        if (serialPort->open(QIODevice::ReadWrite))
 
        {
 
            // set port settings
 
            selectBaudRate(ui->cbBaudRate->currentText());
 
            selectParity((QSerialPort::Parity) parityButtons.checkedId());
 
            selectDataBits((QSerialPort::DataBits) dataBitsButtons.checkedId());
 
            selectStopBits((QSerialPort::StopBits) stopBitsButtons.checkedId());
 
            selectFlowControl((QSerialPort::FlowControl) flowControlButtons.checkedId());
 

	
 
            qDebug() << "Opened port:" << serialPort->portName();
0 comments (0 inline, 0 general)