-
Notifications
You must be signed in to change notification settings - Fork 75
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
AppActions signal is not emitted ! #12
Comments
Your code looks fine. Did you tried the example code in examples/ folder. Do it works? And what is your OS and Qt version? |
I checked both todo and photoalbum and both are working |
I have no idea what was happening in your code. Do you mind to share your code to me? |
I can not share that with you, because it's not my own code, sorry :-(
two stores are not related to eachother, so I did not create adapters folder and those files. ActionTypes.qml full source code: pragma Singleton
import QtQuick 2.0
import QuickFlux 1.0
KeyTable {
id: actionTypes;
property string changeHelp;
property string selectContractor;
property string unselectContractor;
property string loadContractorFromDatabase;
property string saveContractorToDatabase;
property string setContractorMoshakhasat;
property string setContractorTavanFanni;
property string setContractorMali;
property string setContractorTajhizat;
property string setContractorSayer;
property string removeContractorTavanFanniFromList;
property string removeContractorTajhizatFromList;
property string removeContractorSayerFromList;
} qmldir in actions folder singleton ActionTypes 1.0 ActionTypes.qml
singleton AppActions 1.0 AppActions.qml qmldir in stores folder singleton SelectedContractorsStore 1.0 SelectedContractorsStore.qml
singleton ContractorInsertStore 1.0 ContractorInsertStore.qml AppActions.qml full source code: pragma Singleton
import QtQuick 2.0
import QuickFlux 1.0
import "."
ActionCreator {
signal changeHelp(string text, string state);
signal selectContractor(int cId);
signal unselectContractor(int cId);
signal loadContractorFromDatabase(int cId);
signal saveContractorToDatabase(int cId);
signal setContractorMoshakhasat(var d);
signal setContractorTavanFanni(var d);
signal setContractorMali(var d);
signal setContractorTajhizat(var d);
signal setContractorSayer(var d);
signal removeContractorTavanFanniFromList(int index);
signal removeContractorTajhizatFromList(int index);
signal removeContractorSayerFromList(int index);
} In view, I've checked input parameter and they are valid. |
I have another question. Can I use this library in C++? |
I tested the code in windows with mingw compiler and Qt 5.7.0 In linux, there is no error, but does not work. PS: I had to add |
Do you mean to use QuickFlux in a plugin library?
QFAppDispatcher is the C++ implementation of AppDispatcher. It is possible to send and receive action message in C++. Moreover, it has an utility function , QFAppDispatcher::singletonObject(), to obtain the instance of QML singleton object from C++ . So the answer should be possible, but I am not sure is it a good approach. I usually just declare AppActions / stores in QML. Then obtain the instance by the singletonObject() in C++ |
It's not a plugin, but a simple Shared library. In main project, I added library via right clicking in .pro file and selecting 'Add Library', then selecting .so file path and include folder of that library. |
I never tried to use it in a shared library but I don't see any reason that not able to do so. Any chance that you have two QQmlEngine instance running? |
I don't think so. I use ...
QQmlApplicationEngine engine;
engine.addImageProvider("manpower", new ManPowerImageProvider());
engine.addImageProvider("slideshow", new SlideShowImageProvider());
engine.rootContext()->setContextProperty("DB", db);
engine.load(QUrl(QStringLiteral("qrc:/assets/qml/main.qml")));
return app.exec(); That's what I have done with QQmlApplicationEngine. (in main function) |
Then I have no idea what is the problem. Sorry |
I included pri file in main project file to use QuickFlux directly in my project, but it does not work neither. |
Hi @benlau
I want to use Flux in my app. I followed the guides, but I have a problem.
AppActions signal is not called at all !!!
in my view:
AppActions.qml
ActionTypes.qml
my store:
But nothing is printed in console !!!
Even no error is reported
I have qmldirs files in actions and stores folders
What am I doing wrong?
Thanks
The text was updated successfully, but these errors were encountered: