Qt creator (mask a variable)
Qt Creator and other tools
2
Posts
2
Posters
1.2k
Views
1
Watching
-
wrote on 26 Feb 2015, 07:50 last edited by
Hello
I make a project for my school, I need to comminucate with USB and write/read some informations.
usually live I use C language and I make mask easily. I need just make a mask with my variable dataL.
my program is
@
void MainWindow::on_pushButton_clicked()
{if(flag == 0) { ui->pushButton->setText("Activé"); ui->pushButton->setToolTip("désactivé ?"); ui->pushButton->setStyleSheet("* { background-color: rgb(125,255,100) }"); flag = 1; QByteArray dataL = serial->readAll(); dataL = (dataL | 0b1000); serial->write(dataL); } else { ui->pushButton->setText("Désactivé"); ui->pushButton->setToolTip("activé ?"); ui->pushButton->setStyleSheet("* { background-color: rgb(255,125,100) }"); flag = 0; serial->write("0000"); }
}@
When I compile the line 11 say : QByteArray::operator QNoImplicitBoolCast() const' is private
if someone can help me.
Zirtek
-
Hi,
QByteArray is not a byte so you can't just mask it like that. You first need to extract the values you want to mask.
In any case, you're not using QSerialPort correctly. readAll() will only give you something if you have data available. You should rather take a look at the terminal example to see how it works.
1/2