
Originally Posted by
alizadeh91
You said that the sound is not playing and the app has launched. so the problem is not triggered by dll and i think it has to be the path. are u sure about path of your sound files? ( have u added it into your resources or gave it an absolute path?)
QMediaPlayer cant play sound from resource and yes I give it absoulutePath base on QApplication::applicationDirPath() so it is not the problem!
And No it doesnt start unless I put this line of codes in main (I must put application in c:/Setup in this way !)
#include "mainwindow.h"
#include <QApplication>
int main(int argc, char *argv[])
{
qApp
->setLibraryPaths
(QStringList()<<
"C:/Setup"<<
"C:/Setup/plugins");
MainWindow w;
w.show();
return a.exec();
}
#include "mainwindow.h"
#include <QApplication>
int main(int argc, char *argv[])
{
qApp->setLibraryPaths(QStringList()<<"C:/Setup"<<"C:/Setup/plugins");
QApplication a(argc, argv);
MainWindow w;
w.show();
return a.exec();
}
To copy to clipboard, switch view to plain text mode
Added after 22 minutes:
I tried fllowing code and now every thing seems to work in other pc's except the music part(It doesnt use dsengine from plugin floder *I put the whole plugin folder in my application folder *!!!see this image !Wow!.jpg ) Maybe a bug in Qt?!
#include "mainwindow.h"
#include <QApplication>
int main(int argc, char *argv[])
{
split.removeAt(split.size()-1);
qApp
->setLibraryPaths
(QStringList()<<path<<path
+"\\plugins"<<path
+"\\plugins\\mediaservice");
//path+"\\plugins\\mediaservice" because dsengine.dll is located in mediaservice folder I tried with out it too!!
MainWindow w;
w.show();
return a.exec();
}
#include "mainwindow.h"
#include <QApplication>
int main(int argc, char *argv[])
{
QStringList split=QString(argv[0]).split("\\");
split.removeAt(split.size()-1);
QString path=split.join("\\");
qApp->setLibraryPaths(QStringList()<<path<<path+"\\plugins"<<path+"\\plugins\\mediaservice");//path+"\\plugins\\mediaservice" because dsengine.dll is located in mediaservice folder I tried with out it too!!
QApplication a(argc, argv);
MainWindow w;
w.show();
return a.exec();
}
To copy to clipboard, switch view to plain text mode
Bookmarks