larpon / QtFirebase

An effort to bring Google's Firebase C++ API to Qt + QML
MIT License
284 stars 83 forks source link

Using Qtfirebase #141

Closed shariatraad closed 4 years ago

shariatraad commented 4 years ago

Hello :) I've been able to import Qtfirebase in my Qt project and I can run my app without crashing. I just have one "big" question. How can I use Qtfirebase different functions in my project? for example if I want to write something from my app in my firebase console. Are there any documentations that I can refer to so I can get to know these functions?

isdsi commented 4 years ago

What do you mean 'write something from my app in my firebase console'? Is it the 'firebase cloud messaging'?

shariatraad commented 4 years ago

sorry for my bad initial explanation. I meant if I want to store some data from my app on my database. For example on my app I'm using phones camera and currently the camera output is stored on phone's internal storage. what if I want to store it on firebase database (cloud or real-time) instead of phone's storage?

isdsi commented 4 years ago

Yes, you can do it. The QtFirebaseExample has 'firebase database' example. Please, check the first big menu 'database'

isdsi commented 4 years ago

If you use the firebase database, you can insert some data to it serverlessly.

shariatraad commented 4 years ago

Thank you again for your answer and your time :) Are you referring to Database.qml in QtFirebaseExample? If so I should also mention that in my application I'm using c++ classes and not qml types. That's why I asked at very beginning for any sort of documentations that I can have access to.

isdsi commented 4 years ago

Yes. You can access with 'Database.qml'. I think QtFirebase is for mobile application(android/ios). If you want to develop an mobile application, you may use qt qml. But If you know only c++, you can learn one time 'c++ class to qml type'.

https://doc.qt.io/qt-5/qtqml-cppintegration-contextproperties.html

shariatraad commented 4 years ago

I see. thank you so much. I have already built my phone application for android using only c++ classes. I will check the link you've provided, at first glance I can see that it's very helpful! Just to confirm there is no way to access QtFireBase database directly from c++ classes and it is only accessible through QML types right?

larpon commented 4 years ago

All QML types are usable in C++. They're defined in C++ - thus also usable from C++?

larpon commented 4 years ago

So everything you can do in QML you can do in C++.

shariatraad commented 4 years ago

Hello Larpon. Thanks for the reply. Yes QML types are defined in c++ as well. That's why I was a bit confused when It was suggested to integrate c++ into QML. (Which is also fine but only if there is not an equivalent c++ class/function for that particular QML type or vice versa). Which brings me back to the same question that I asked above :) How can I get information about the Qtfirebase c++ classes and functions? Are there any particular documentations for that?

larpon commented 4 years ago

Ah. Well QtFirebase is really just a thin wrapper layer over Google's Firebase C++ SDK. So the official firebase C++ documentation and some grep'ing around the classes in /src is currently the only thing I can offer you as documentation or guidance.

So for example if you need to know how QtFirebase Database works:

... and qtfirebase.h is a singleton wrapping firebase::App

We currently haven't got resources for much more than DIY research and discovery :)

And please contribute back if you implement something we've missed! Better documentation is also welcome!

shariatraad commented 4 years ago

Thank you so much Larpon for the detailed explanation! That's exactly what I was looking for! After I manage to implement something worthy to share I will definitely post it so others can use it as well!

larpon commented 4 years ago

Perfect!