[this one sucks] Application works only in specific folder, exits silently in another folder
-
Could you show us the contents of your resources.qrc file?
-
Yeah, no problem.
@<RCC>
<qresource prefix="/">
<file>main.qml</file>
<file>images/haken_gruen.gif</file>
<file>images/connected.png</file>
<file>images/not-connected.png</file>
<file>desktop-components/components/plugin/libstyleplugin.a</file>
<file>desktop-components/components/Button.qml</file>
<file>desktop-components/components/ButtonRow.qml</file>
<file>desktop-components/components/CheckBox.qml</file>
<file>desktop-components/components/ChoiceList.qml</file>
<file>desktop-components/components/components.pro</file>
<file>desktop-components/components/ContextMenu.qml</file>
<file>desktop-components/components/Dial.qml</file>
<file>desktop-components/components/Frame.qml</file>
<file>desktop-components/components/GroupBox.qml</file>
<file>desktop-components/components/Makefile</file>
<file>desktop-components/components/ProgressBar.qml</file>
<file>desktop-components/components/qmldir</file>
<file>desktop-components/components/RadioButton.qml</file>
<file>desktop-components/components/ScrollArea.qml</file>
<file>desktop-components/components/ScrollBar.qml</file>
<file>desktop-components/components/Slider.qml</file>
<file>desktop-components/components/SpinBox.qml</file>
<file>desktop-components/components/Switch.qml</file>
<file>desktop-components/components/Tab.qml</file>
<file>desktop-components/components/TabBar.qml</file>
<file>desktop-components/components/TabFrame.qml</file>
<file>desktop-components/components/TableView.qml</file>
<file>desktop-components/components/TextArea.qml</file>
<file>desktop-components/components/TextField.qml</file>
<file>desktop-components/components/ToolBar.qml</file>
<file>desktop-components/components/ToolButton.qml</file>
<file>desktop-components/components/custom/BasicButton.qml</file>
<file>desktop-components/components/custom/Button.qml</file>
<file>desktop-components/components/custom/ButtonColumn.qml</file>
<file>desktop-components/components/custom/ButtonGroup.js</file>
<file>desktop-components/components/custom/ButtonRow.qml</file>
<file>desktop-components/components/custom/CheckBox.qml</file>
<file>desktop-components/components/custom/ChoiceList.qml</file>
<file>desktop-components/components/custom/components.pro</file>
<file>desktop-components/components/custom/GroupBox.qml</file>
<file>desktop-components/components/custom/ProgressBar.qml</file>
<file>desktop-components/components/custom/qmldir</file>
<file>desktop-components/components/custom/Slider.qml</file>
<file>desktop-components/components/custom/SpinBox.qml</file>
<file>desktop-components/components/custom/TextField.qml</file>
<file>desktop-components/components/custom/behaviors/ButtonBehavior.qml</file>
<file>desktop-components/components/custom/behaviors/ModalPopupBehavior.qml</file>
<file>desktop-components/components/custom/private/ChoiceListPopup.qml</file>
</qresource>
</RCC>
@ -
Hi Hedge,
this
@
<qresource prefix="/">
@is not needed, it could be
@
<qresource prefix="">
@ -
Thanks for the suggestion. That doesn't fix the problem though.
Do you have other suggestions? -
This works for me:
------ main.cpp ------
@#include <QtGui/QApplication>
#include <QDeclarativeView>int main(int argc, char *argv[])
{
QApplication app(argc, argv);QDeclarativeView view; view.setSource(QUrl("qrc:/qml/QMLwithResource/main.qml")); view.show();- return app.exec();
}
@------ qmlresource.qrc ------
@
<RCC>
<qresource prefix="/">
<file>qml/QMLwithResource/main.qml</file>
</qresource>
</RCC>
@Watch out if you use the autogenerated qmlapplicationviewer, it has a setMainQmlFile which takes a QString as argument. On the Mac the path is adjusted to look into the AppBundle.app/Contents/Resources directory. You might want to adjust that class to take a QUrl as argument.
-
Hello Volker. The problem must be the:
@import "desktop-components/components"@
inside the main.qml file. It works without it (I replaced the whole GUI with just a rectangle).
-
It works for me too (all in resources, no access to files on the disk):
@
<RCC>
<qresource prefix="/">
<file>qml/QMLwithResource/main.qml</file>
<file>qml/QMLwithResource/parts/FancyText.qml</file>
</qresource>
</RCC>
@In main.qml I have :
@
import QtQuick 1.0
import "parts"Rectangle {
width: 360
height: 360
Text {
id: ttt
text: "Hello World"
anchors.centerIn: parent
}
Text {
id: blurb
text: "blurb"
anchors.top: ttt.bottom
anchors.horizontalCenter: parent.horizontalCenter
}
FancyText {
id: ft
anchors.top: blurb.bottom
anchors.horizontalCenter: parent.horizontalCenter
}MouseArea { anchors.fill: parent onClicked: { Qt.quit(); } }
}
@FancyText.qml is
@
import QtQuick 1.0Item {
id: fancyTextId
width: 100
height: 62
Text {
id: fancytextid
text: "This is a fancy text"
}
}
@You can add this snippet to your main.cpp, at the beginning. It shows you in which paths the qml files are searched for:
@
QByteArray data = "1";
qputenv("QML_IMPORT_TRACE", data);
@ -
@ QByteArray data = "1";
qputenv("QML_IMPORT_TRACE", data);
qDebug() << data;@Output is "1" still.
You've spend so much time with my project.
I hope I can make it to the Qt Summit and spend a beer.Now that you already have a test-setup why don't you try the desktop-components http://qt.gitorious.org/qt-components/desktop (release-build + move exe to another folder).
I smell there's some bullshit going on there because when I run the release-build exe through Qt's debugger there occurs an error within styleplugin.dll .
-
bump New day, new ideas?
-
Sorry, I was too busy today. I didn't forget your issue - stay tuned :)
-
This wasn't specifically referring to you.
I'm tuning the OSX-version in the meantime.
Oh btw. I don't have this problem on OSX. I can put the app anywhere and it works fine. -
Ok I did another try.
This time I added ALL files of desktop-components to the qrc-file (even the dll which isn't supposed to be there) but still no luck.It's clearly the line import "desktop-components/components" in main.qml which make the application crash.
-
DLLs cannot be loaded from qrc files anyways - it will just bloat the exe. I still need my MinGW environment to check on a Windows box :)