PDA

View Full Version : QT If And Else Error



Mofadal
3rd March 2017, 17:59
12375
This Return 2 (Error05) in combobox
What Is Wrong In Code

anda_skoa
4th March 2017, 12:52
If you want to post code, post text, not an image.

And it would be helpful to state what your actual question or problem is.

Cheers,
_

d_stranz
4th March 2017, 18:32
As anda_skoa says, post code, not a picture of code.


What Is Wrong In Code

Nothing is wrong in the code. The variable "checksam" doesn't contain the string you are looking for, so the code does what you told it to do: it puts the string "ERR05" in the combobox.

Mofadal
5th March 2017, 07:19
OK This Is Code

void MainWindow::on_pushButton_29_clicked()
{
foreach (const QSerialPortInfo&info, QSerialPortInfo::availablePorts()){
QString checksam;
checksam=info.description();
if (checksam.contains("SAMSUNG MOBILE USB MODEM"))
{
ui.samlogs->append(info.description());
}
else
{
ui.samlogs->append("NO SAMSUNG MOBILE FOUND PLEASE CONECT YOUR PHONE");
}
{
}
}
}

d_stranz
5th March 2017, 21:13
And so what exactly is your problem? If you have a question, ask it, just don't post code and say nothing about it.