icesimon's Blog

  • About Me
  • Archive
  • feeds

Posts match “ QML ” tag:

over 9 years ago

How to check debug messages in Cascades?

Just use some simple steps can let you check debug messages!

  1. Open the main.cpp in your project. Only need to add two code snippets!

  2. First: Insert this before int main

    void myMessageOutput(QtMsgType type, const char* msg) 
    

    {
    std::fprintf(stdout, "%s\n", msg);
    std::fflush (stdout);
    }

  3. Second:Inset snippet after Application app(argc, argv);

    qInstallMsgHandler(myMessageOutput);
    
  4. 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! ^^

  • BlackBerry
  • Cascades
  • Debug
  • BB10
  • QML
  • c++
  • June 29, 2014 14:47
  • Permalink
  • Comments
 
almost 8 years ago

Keep Screen awake - BB10 Dev

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

  • BlackBerry
  • BlackBerry10
  • Cascades
  • awake
  • dim
  • screen
  • QML
  • application
  • Tips
  • October 08, 2015 20:49
  • Permalink
  • Comments
 
over 7 years ago

Use QML to play music in Cascades

MediaPlayer

Steps:

  1. Add bb.multimedia 1.0 in qml file.

  2. Create a MediaPlayer Object.

  3. Set path of file for MediaPlayer. (Need permission for access_shared)

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

  • BlackBerry
  • BB10
  • Cascades
  • QML
  • MediaPlayer
  • music
  • January 31, 2016 11:13
  • Permalink
  • Comments
 

Copyright © 2013 icesimon . Powered by Logdown.
Based on work at subtlepatterns.com.