[Solved] Static qml app shows only white window.



  • I have finished a game. I've used QML. there is a lot of qml, 2 js and 100 png files. My app is running regularly in qt creator when F5 pressed. But when I try make clean with "qmake -static -release", my app.exe just showing big white window. By the way, I have already added "CONFIG += staticlib" to my app.pro file. I have also built qt and my other qt apps staticly. I even have shared them with my friends. But I cant build static my qml apps. I try open a new qml project and build the qt qml beginner "hello world" app staticly. I show the same issue.
    A little thing, all my static qml app.exe files are ~12 mb, why?



  • Seems like app can't find qml files. Try move your qml files in app's resources and used it from there.

    [quote author="Busta Bug" date="1317744776"]A little thing, all my static qml app.exe files are ~12 mb, why?[/quote]

    Because QtGui, QtCore and QtDeclarative libs placed into your exe file now.



  • Sorry, How do you can it? I added a resource file to my pro. And added main.qml I tried use it in main.cpp but not found main.qml.

    viewer.setMainQmlFile(QLatin1String(":/qml/nm/main.qml"));
    or
    ("qrc:/qml/nm/main.qml"));
    or
    ("qrc:/main.qml"));
    even or
    (":/main.qml"));

    but not run

    what can I do?



  • When you adding qml files to qrc you should set preffix. What do preffix you set?



  • "/" like it



  • the prefix is "/", But Not running, just a white wiindow.



    1. use “qrc:/main.qml”
    2. Open your qmlapplicationviewer.cpp file
    3. Find method @void QmlApplicationViewer::setMainQmlFile(const QString &file)@
    4. Find line with @d->view->setSource(QUrl::fromLocalFile(d->mainQmlFile));@
    5. Change this line: @d->view->setSource(QUrl(d->mainQmlFile));@


  • Yes I got it .I just have built staticly.It is finished.Where do I share its hotfile link to show other qt devs?
    Very very thanks!!!



  • We have "Showcase":http://developer.qt.nokia.com/forums/viewforum/8/ section on this forum, you can create topic with link on your app there.


  • Moderators

    Be sure and edit your post title to add [Solved] at the beginning. Thanks!


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.