Namespaces

Variants
Actions

Please note that as of October 24, 2014, the Nokia Developer Wiki will no longer be accepting user contributions, including new entries, edits and comments, as we begin transitioning to our new home, in the Windows Phone Development Wiki. We plan to move over the majority of the existing entries over the next few weeks. Thanks for all your past and future contributions.

Como converter um TBuf para QString

From Wiki
Jump to: navigation, search

This page was last modified on 9 September 2009, at 04:03.



Article Metadata

Testado com
Aparelho(s): Emulator

Compatibilidade
Plataforma(s): S60 3rd Edition FP1, S60 3rd Edition FP2, S60 5th Edition

Artigo
Palavras-chave: QString,TBuf
Tradução:
Por valderind4
Última alteração feita por hamishwillee em 30 May 2013


Introdução

Este trecho de código, demostra como coverter um TBuf (Descritor Symbian) para QString (Qt for Symbian) .

Pré-requisitos


Código fonte

#include <QtGui>
#include <QApplication>
#include <qstring.h>
#include <QLabel>
#include <QVBoxLayout>
#include <QWidget>
 
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
QWidget *win = new QWidget;
QLabel *label = new QLabel();
QVBoxLayout *layout = new QVBoxLayout;
 
_LIT(KMsg,"Hello");
TBuf<10> buf(KMsg);
QString qString((QChar*)buf.Ptr(),buf.Length());
 
label->setText(qString);
layout->addWidget(label);
 
win->setLayout(layout);
win->show();
 
return a.exec();
}

Captura de tela

Buffff.PNG

This page was last modified on 30 May 2013, at 04:37.
222 page views in the last 30 days.

Was this page helpful?

Your feedback about this content is important. Let us know what you think.

 

Thank you!

We appreciate your feedback.

×