My project works on Qt Simulator, but not on my real device.
Here is my project:
clean.h
Code:
#include <QtGui/QApplication>
#include "qmlapplicationviewer.h"
#include <QObject>
#include <QApplication>
#include <QDeclarativeView>
#include <QDeclarativeContext>
#ifndef CLEAN_H
#define CLEAN_H
Q_OBJECT
public:
explicit Clean
(QObject *parent
= 0); ~Clean
();
//void deleteDir();
//void deleteFile();
Q_INVOKABLE void clean1();
};
#endif // CLEAN_H
clean.cpp
Code:
#include <QtGui/QApplication>
#include "qmlapplicationviewer.h"
#include <QObject>
#include <QApplication>
#include <QDeclarativeView>
#include <QDeclarativeContext>
#include <QFile>
#include <QDir>
#include "clean.h"
void deleteDir(const std::string& foldername) {
dir.remove(foldername.c_str());
}
void deleteFile(const std::string& filename) {
file.remove(filename.c_str());
}
}
Clean::~Clean() {
}
void Clean::clean1() {
deleteDir(e:/data);
deleteFile(e:/qf)
}
main.cpp
Code:
#include "clean.h"
int main(int argc, char *argv[])
{
Clean clean;
QDeclarativeView view;
view.setResizeMode(QDeclarativeView::SizeRootObjectToView);
view.rootContext()->setContextProperty("Clean", &clean);
view.
setSource(QUrl("qml/GCleaner/main.qml"));
return app.exec();
}
main.qml
Code:
Button {
id:button
onClicked: Clean.clean1()
}
It works very well on Qt Simulator, but not work on my mobile device. I also tried to add qdir.h and qfile.h but it exited with code -1073741819.
What should I do? Thank you so much for your help.
Re: My project works on Qt Simulator, but not on my real device.
What kind of device? What exactly happens?
Re: My project works on Qt Simulator, but not on my real device.
My device is Nokia E6, OS is Belle.
When I open this app on phone from Main Menu, it does not show anything. The screen goes blank then the Main Menu is refreshed.
Thanks for your help.
Re: My project works on Qt Simulator, but not on my real device.
I think your program simply crashes. You need to debug it and see what's wrong.
Re: My project works on Qt Simulator, but not on my real device.
It says that:
Debugging starts
QDeclarativeDebugServer: Ignoring "-qmljsdebugger=port:3768,block". Debugging has not been enabled.
Debugging has finished.
Re: My project works on Qt Simulator, but not on my real device.
Re: My project works on Qt Simulator, but not on my real device.
I have tried all things I know but it's still not solved. :(
I study Qt myself and no one in my region can help me, sir. Should I go to Qt4.8? The current Qt version that I am using is 4.7.4.
Re: My project works on Qt Simulator, but not on my real device.
You should make sure that you build your project in debug mode and that you have prepared your device for debugging. I'm sure there are documents about it in the internet.
Re: My project works on Qt Simulator, but not on my real device.
Okay sir. I shall try again then tell everything here. Thank you so much for your help.
Sincerely. :)