[Qt-qml] Multiple qml files in one .cpp
Kai Koehne
kai.koehne at nokia.com
Fri Aug 27 13:39:06 CEST 2010
On 8/27/2010 12:45 PM, ext Sulamita Garcia wrote:
> Thanks for the answers, but the only thing that worked was changing the
> setSource to the absolute path:
>
> view.setSource(QUrl::fromLocalFile("/home/sulamita/src/samegame/samegame.qml"));
Are you sure that you're running it really from within
'/home/sulamita/src/samegame' ? E.g. Qt Creator by default does shadow
building ...
Anyway, a safer way to write this should be
QString absolutePath = QCoreApplication::applicationDirPath () +
"/samegame.qml";
QUrl::fromLocalFile(QUrl::fromLocalFile(absolutePath));
(given that your executable is indeed in the same directory as
samegame.qml).
Kai
--
Kai Koehne
Software Engineer
Nokia, Qt Development Frameworks
Nokia gate5 GmbH
Firmensitz: Invalidenstr. 117, 10115 Berlin, Germany
Registergericht: Amtsgericht Charlottenburg, Berlin: HRB 106443 B
Umsatzsteueridentifikationsnummer: DE 812 845 193
Geschäftsführer: Dr. Michael Halbherr, Karim Tähtivuori
More information about the Qt-qml
mailing list