Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. [SOLVED]Conversion from "QString" to ...
Forum Updated to NodeBB v4.3 + New Features

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

Scheduled Pinned Locked Moved General and Desktop
3 Posts 2 Posters 1.2k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • w00t1234W Offline
    w00t1234W Offline
    w00t1234
    wrote on last edited by
    #1

    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

    1 Reply Last reply
    0
    • R Offline
      R Offline
      Rondog
      wrote on last edited by
      #2

      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);
      }
      @

      1 Reply Last reply
      0
      • w00t1234W Offline
        w00t1234W Offline
        w00t1234
        wrote on last edited by
        #3

        [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

        1 Reply Last reply
        0

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved