Archived:Совместное использование кода Symbian C++ и Qt
Отправлено в архив: Данная статья отправлена в архив так как, на сегодняшний день, не представляет ценности для сторонних разработчиков коммерческих решений. If you think this article is still relevant, let us know by adding the template {{ForArchiveReview|write your reason here}}.
Qt Quick should be used for all UI development on mobile devices. The approach described in this article (using C++ for the Qt app UI) is deprecated.
Qt Quick should be used for all UI development on mobile devices. The approach described in this article (using C++ for the Qt app UI) is deprecated.
Метаданные
Статья базируется на материалах англоязычной части Wiki, все они перечислены в разделе Archived:Совместное использование кода Symbian C++ и Qt#Ссылки.
Contents |
Обзор
В данной статье рассматривается возможность совместного использования кода Symbian C++ и Qt. Статья находится в разработке и будет обновляться.
Использование дескрипторов Symbian в Qt
Преобразование TBuf в QString
#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();
}
Преобразование HBufC в QString
#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");
HBufC* buf = KMsg().Alloc();
QString qString((QChar*)buf->Des().Ptr(),buf->Length());
label->setText(qString);
layout->addWidget(label);
win->setLayout(layout);
win->show();
delete buf;
return a.exec();
}
Ссылки
При подготовке статьи использованы следующие материалы:

