Just use some simple steps can let you check debug messages!
Open the main.cpp in your project. Only need to add two code snippets!
-
First: Insert this before int main
void myMessageOutput(QtMsgType type, const char* msg)
{
std::fprintf(stdout, "%s\n", msg);
std::fflush (stdout);
} -
Second:Inset snippet after Application app(argc, argv);
qInstallMsgHandler(myMessageOutput);
-
Here are the whole code snippets
void myMessageOutput(QtMsgType type, const char* msg) { std::fprintf(stdout, "%s\n", msg); std::fflush(stdout); } Q_DECL_EXPORT int main(int argc, char **argv) { Application app(argc, argv); qInstallMsgHandler(myMessageOutput); // localization support QTranslator translator; QString locale_string = QLocale().name(); QString filename = QString( "YourApp_%1" ).arg( locale_string ); if (translator.load(filename, "app/native/qm")) { app.installTranslator( &translator ); } new YourApp(&app); return Application::exec(); }
Enjoy all your dubeg messages! ^^
Sometimes we need to keep our app always awake (not dim due to the Screen timeout).
How to make this happen?
The answer is ver simple :D
Jusy put the code into your QML file
Application.mainWindow.screenIdleMode = 1
(1 means KeepAwake, and 0 means Default).
Please be careful, this effect only works when the app is in full screen mode
Once you minimize the app (in Active Frame mode), the screen will still follow the screen timeout rule to dim.
Hope you enjoy this trick!
Simon
MediaPlayer
Steps:
Add bb.multimedia 1.0 in qml file.
Create a MediaPlayer Object.
Set path of file for MediaPlayer. (Need permission for access_shared)
Call the play() function of MediaPlayer. (Need permission Run when background if you want to play music in background).
BlackBerry 10 can support file format below:
AAC: audio/aac, audio/x-aac
AMR: audio/amr, audio/x-amr
FLAC: audio/flac
M4A: audio/m4a, audio/mp4
MIDI: audio/midi, audio/mid, audio/x-midi, audio/x-mid
MKA: audio/x-matroska
MP3: audio/mp3
OGG: audio/ogg
QCP: audio/x-gsm
SPMID: audio/spmid
WAV: audio/wav, audio/x-wav
WMA: audio/x-ms-wma