Results 1 to 4 of 4

Thread: Other conversion posible

  1. #1
    Join Date
    Sep 2016
    Posts
    78
    Thanked 1 Time in 1 Post
    Qt products
    Qt5

    Default Other conversion posible

    Hi i have one question about this example:
    QByteArray array;
    array = ui->textocuenta->text().toLatin1();
    I could use other conversion for the text different toLatin1????

  2. #2
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Other conversion posible

    Yes, QString has built in conversions for "latin1" (western european charset), "utf8" and "local 8 bit" (depends on local settings).

    An even wider range of encodings can be done through QTextCodec.

    Cheers,
    _

  3. #3
    Join Date
    Sep 2016
    Posts
    78
    Thanked 1 Time in 1 Post
    Qt products
    Qt5

    Default Re: Other conversion posible

    pls can you take me a exampel of this:
    datoss = "|@|" + ui->textocuenta->text().toLatin1() + "|@|";

    with qtextcode. thanks in advance. I need because i need to avoid this conversion.

  4. #4
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Other conversion posible

    The QTextCodec equivalent of
    Qt Code:
    1. const QByteArray data = ui->textocuenta->text().toLatin1();
    To copy to clipboard, switch view to plain text mode 
    is
    Qt Code:
    1. QTextCodec *codec = QTextCodec::codecForName("latin1");
    2. const QByteArray data = codec->fromUnicode(ui->textocuenta->text());
    To copy to clipboard, switch view to plain text mode 

    Cheers,
    _

Similar Threads

  1. conversion from qt,c++ to c++
    By shyamkute in forum Newbie
    Replies: 5
    Last Post: 5th November 2014, 10:47
  2. Replies: 0
    Last Post: 18th September 2012, 21:44
  3. Hex Conversion
    By umulingu in forum Newbie
    Replies: 5
    Last Post: 5th March 2010, 18:07
  4. is it posible to invert the axes?
    By jbca in forum Qwt
    Replies: 2
    Last Post: 18th January 2010, 15:34
  5. Reg - Conversion of Qt3 to Qt4
    By suresh in forum Qt Programming
    Replies: 10
    Last Post: 28th August 2006, 23:10

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.