×
Namespaces

Variants
Actions
(Difference between revisions)

Como converter um TBuf para QString

From Nokia Developer Wiki
Jump to: navigation, search
hamishwillee (Talk | contribs)
m (Hamishwillee - Adding missing translation link)
hamishwillee (Talk | contribs)
m (Text replace - "<code cpp>" to "<code cpp-qt>")
Line 50: Line 50:
 
== Código fonte ==
 
== Código fonte ==
  
<code cpp>
+
<code cpp-qt>
  
 
#include <QtGui>
 
#include <QtGui>

Revision as of 04:16, 11 October 2012

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 11 Oct 2012


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

80 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.

×