×
Namespaces

Variants
Actions
Revision as of 10:17, 3 September 2009 by croozeus (Talk | contribs)

How to convert TBuf to QString

From Nokia Developer Wiki
Jump to: navigation, search


Article Metadata
Tested with
Devices(s): Emulator
Compatibility
Platform(s): S60 3rd Edition FP1, S60 3rd Edition FP2, S60 5th Edition
Article
Keywords: QString,TBuf
Created: (17 Jan 2009)
Last edited: croozeus (03 Sep 2009)


Overview

This code snippet demonstrates how to convert TBuf (Symbian Descriptor) to QString (Qt for S60) .

Preconditions


Source File

#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();
}

Screenshot

Buffff.PNG

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

×