[SOLVED]Conversion from "QString" to ...



  • Hi Guys I Have A Problem.

    @ QByteArray data = ui->veri_gonder->toPlainText();
    if(_serial->isOpen())
    {
    _serial->write(data);
    }@

    Ugs Error:

    @C:\Users*****\mainwindow.cpp:80: error: conversion from 'QString' to non-scalar type 'QByteArray' requested
    QByteArray data = ui->veri_gonder->toPlainText();
    ^@

    Help Me Please



  • The option toPlainText() still returns a QString. It just doesn't have the formatting data from the QTextEdit widget.

    This should work:

    @
    QByteArray data = ui->veri_gonder->toPlainText().toLatin1();
    if(_serial->isOpen())
    {
    _serial->write(data);
    }
    @



  • [quote author="Rondog" date="1423698234"]The option toPlainText() still returns a QString. It just doesn't have the formatting data from the QTextEdit widget.

    This should work:

    @
    QByteArray data = ui->veri_gonder->toPlainText().toLatin1();
    if(_serial->isOpen())
    {
    _serial->write(data);
    }
    @[/quote]

    Thanks Superman :) SOLVED


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.