Hello! I am working on a project for Symbian S60 v3 using Qt 4.7.3 and I need to intercept events such as Red Key Pressed. I have found some examples on how to do it, but when I try it myself I get the following errors:
I have added the path to these files in my .PRO file:Code:mainwindow.h:5: error: avkon.hrh: No such file or directory mainwindow.h:6: error: w32std.h: No such file or directory mainwindow.h:34: error: ISO C++ forbids declaration of 'TWsEvent' with no type mainwindow.h:34: error: expected ',' or '...' before '&' token
INCLUDEPATH += C:\\QtSDK\\Symbian\\SDKs\\Symbian1Qt473\\epoc32\\include
This seems to have solved the problem, but then I get the following errors
e32des16.h:691: error: #error no typedef for __TText
e32def.h:872: error: 'Int64' does not name a type
e32def.h:883: error: 'Uint64' does not name a type
e32const.h:860: error: 'TInt64' does not name a type
e32const.h:882: error: 'TUint64' does not name a type
e32cmn.h:41: error: 'IMPORT_C' does not name a type
e32cmn.inl:2537: error: no matching function for call to 'TBufBase8::TBufBase8(int)'
After declaring Int64, Uint64, TInt64 and TUint64 some of the messages disappear, but I don't know how to solve the others.
I am asking if someone knows what the problem is and how to solve it.
Here is the code for my app:
.PRO file:
mainwindow.hCode:# Add files and directories to ship with the application # by adapting the examples below. # file1.source = myfile # dir1.source = mydir DEPLOYMENTFOLDERS = # file1 dir1 symbian:TARGET.UID3 = 0xE09286BD # Smart Installer package's UID # This UID is from the protected range # and therefore the package will fail to install if self-signed # By default qmake uses the unprotected range value if unprotected UID is defined for the application # and 0x2002CCCF value if protected UID is given to the application #symbian:DEPLOYMENT.installer_header = 0x2002CCCF # Allow network access on Symbian symbian:TARGET.CAPABILITY += NetworkServices # If your application uses the Qt Mobility libraries, uncomment # the following lines and add the respective components to the # MOBILITY variable. # CONFIG += mobility # MOBILITY += SOURCES += main.cpp mainwindow.cpp HEADERS += mainwindow.h FORMS += mainwindow.ui INCLUDEPATH += C:\\QtSDK\\Symbian\\SDKs\\Symbian1Qt473\\epoc32\\include # Please do not modify the following two lines. Required for deployment. include(deployment.pri) qtcAddDeployment()
mainwindow.cppCode:#ifndef MAINWINDOW_H #define MAINWINDOW_H #include <QtGui/QMainWindow> #include "avkon.hrh" #include "w32std.h" namespace Ui { class MainWindow; } class MainWindow : public QMainWindow { Q_OBJECT public: enum ScreenOrientation { ScreenOrientationLockPortrait, ScreenOrientationLockLandscape, ScreenOrientationAuto }; explicit MainWindow(QWidget *parent = 0); virtual ~MainWindow(); // Note that this will only have an effect on Symbian and Fremantle. void setOrientation(ScreenOrientation orientation); void showExpanded(); private: Ui::MainWindow *ui; private slots: void HandleWsEventL(const TWsEvent &aEvent, CCoeControl *aDestination); }; #endif // MAINWINDOW_H
Thank you in advance!Code:#include "mainwindow.h" #include "ui_mainwindow.h" #include <QtCore/QCoreApplication> MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow) { ui->setupUi(this); } MainWindow::~MainWindow() { delete ui; } void MainWindow::setOrientation(ScreenOrientation orientation) { #if defined(Q_OS_SYMBIAN) // If the version of Qt on the device is < 4.7.2, that attribute won't work if (orientation != ScreenOrientationAuto) { const QStringList v = QString::fromAscii(qVersion()).split(QLatin1Char('.')); if (v.count() == 3 && (v.at(0).toInt() << 16 | v.at(1).toInt() << 8 | v.at(2).toInt()) < 0x040702) { qWarning("Screen orientation locking only supported with Qt 4.7.2 and above"); return; } } #endif // Q_OS_SYMBIAN Qt::WidgetAttribute attribute; switch (orientation) { #if QT_VERSION < 0x040702 // Qt < 4.7.2 does not yet have the Qt::WA_*Orientation attributes case ScreenOrientationLockPortrait: attribute = static_cast<Qt::WidgetAttribute>(128); break; case ScreenOrientationLockLandscape: attribute = static_cast<Qt::WidgetAttribute>(129); break; default: case ScreenOrientationAuto: attribute = static_cast<Qt::WidgetAttribute>(130); break; #else // QT_VERSION < 0x040702 case ScreenOrientationLockPortrait: attribute = Qt::WA_LockPortraitOrientation; break; case ScreenOrientationLockLandscape: attribute = Qt::WA_LockLandscapeOrientation; break; default: case ScreenOrientationAuto: attribute = Qt::WA_AutoOrientation; break; #endif // QT_VERSION < 0x040702 }; setAttribute(attribute, true); } void MainWindow::showExpanded() { #ifdef Q_OS_SYMBIAN showFullScreen(); #elif defined(Q_WS_MAEMO_5) showMaximized(); #else show(); #endif } void MainWindow::HandleWsEventL(const TWsEvent &aEvent, CCoeControl *aDestination) { switch () }

Reply With Quote

