Changeset - c5aa60bf6341
[Not reviewed]
portlist
0 1 0
Hasan Yavuz Ă–ZDERYA - 10 years ago 2015-09-04 18:08:24
hy@ozderya.net
keep port name selection on reload
1 file changed with 7 insertions and 0 deletions:
0 comments (0 inline, 0 general)
portcontrol.cpp
Show inline comments
 
@@ -120,25 +120,32 @@ PortControl::PortControl(QSerialPort* po
 
    loadPortList();
 
    loadBaudRateList();
 
    ui->cbBaudRate->setCurrentIndex(ui->cbBaudRate->findText("9600"));
 
}
 

	
 
PortControl::~PortControl()
 
{
 
    delete ui;
 
}
 

	
 
void PortControl::loadPortList()
 
{
 
    QString currentSelection = ui->cbPortList->currentData(PortNameRole).toString();
 
    portList.loadPortList();
 
    int index = portList.indexOf(currentSelection);
 
    if (index >= 0)
 
    {
 
        ui->cbPortList->setCurrentIndex(index);
 
        tbPortList.setCurrentIndex(index);
 
    }
 
}
 

	
 
void PortControl::loadBaudRateList()
 
{
 
    ui->cbBaudRate->clear();
 

	
 
    for (auto baudRate : QSerialPortInfo::standardBaudRates())
 
    {
 
        ui->cbBaudRate->addItem(QString::number(baudRate));
 
    }
 
}
 

	
0 comments (0 inline, 0 general)