Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. [Solved] .mp3 with Qt
Forum Updated to NodeBB v4.3 + New Features

[Solved] .mp3 with Qt

Scheduled Pinned Locked Moved QML and Qt Quick
19 Posts 4 Posters 11.5k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    spode
    wrote on last edited by
    #10

    yes, from full path it start.
    @ QUrl mp3Url = QUrl::fromLocalFile("../qml/fileTrenner2/compleanno.mp3");
    QDesktopServices::openUrl(mp3Url);
    @ with relative path it does not start...

    1 Reply Last reply
    0
    • L Offline
      L Offline
      loladiro
      wrote on last edited by
      #11

      Make sure your relative path is relative to "QDir::current()":http://doc.qt.nokia.com/4.7/qdir.html#current is. If it isn't you can always use
      @QDir(QCoreApplication::applicationDirPath ()).absoulteFilePath("/path/")@

      1 Reply Last reply
      0
      • S Offline
        S Offline
        spode
        wrote on last edited by
        #12

        thank you. @
        QString s = QDir::current().absolutePath().append("/qml/fileTrenner2/compleanno.mp3");
        QUrl mp3Url = QUrl::fromLocalFile(s);
        QDesktopServices::openUrl(mp3Url); @
        this snippet starts!

        1 Reply Last reply
        0
        • L Offline
          L Offline
          loladiro
          wrote on last edited by
          #13

          If I were you I'd still use applicationDirPath, because the working directory usually changes throughout your application and you cannot be sure that it points to where you want it to point.

          1 Reply Last reply
          0
          • S Offline
            S Offline
            spode
            wrote on last edited by
            #14

            i have this snippet:
            @ QString s = QDir::current().absolutePath().append("/qml/fileTrenner2/compleanno.mp3");
            QUrl mp3Url = QUrl::fromLocalFile(s);
            QDesktopServices::openUrl(mp3Url); @
            i want that the new window opens itself in minimized mode...or i want to move it.
            how to do it?

            1 Reply Last reply
            0
            • S Offline
              S Offline
              spode
              wrote on last edited by
              #15

              so, ideas for fixing?

              1 Reply Last reply
              0
              • L Offline
                L Offline
                loladiro
                wrote on last edited by
                #16

                If you just want to play a mp3 file, I ask you to use $yourFavoriteSearchEngine. There are plenty of threads on the internet dealing with that.

                1 Reply Last reply
                0
                • A Offline
                  A Offline
                  andre
                  wrote on last edited by
                  #17

                  As loladiro suggested: use applicationDirPath.

                  1 Reply Last reply
                  0
                  • L Offline
                    L Offline
                    loladiro
                    wrote on last edited by
                    #18

                    I think you can figure it out yourself. I am happy to give you tips, but I'm not going to write your app for you (or even parts of it).

                    1 Reply Last reply
                    0
                    • S Offline
                      S Offline
                      spode
                      wrote on last edited by
                      #19

                      ahahah that is true! so, thanks!

                      1 Reply Last reply
                      0

                      • Login

                      • Login or register to search.
                      • First post
                        Last post
                      0
                      • Categories
                      • Recent
                      • Tags
                      • Popular
                      • Users
                      • Groups
                      • Search
                      • Get Qt Extensions
                      • Unsolved