Comments (9)
Hi @Trikos
I'm glad to hear you got it working 🙂
I think you're referring to this ?
from qtfirebase.
Yes but you do you get the data inside the console? Im trying to print the qDebug from the C++ code inside this console. How do I achieve this? I think that if I write something I will be overwritten everytime
from qtfirebase.
It's done in the App QML singleton.
If you want to include qDebug messages from C++ I guess you could just set a message handler in C++ that redirects messages to a similar QML singleton or something?
from qtfirebase.
I don't know how to implement this handler. Right now I'm appending text into a QString and emitting a signal every time it gets updated, but it is a very bad implementation xD
from qtfirebase.
I can' t help with any specific setups. I have this code in one of my projects:
void messageOutput(QtMsgType type, const QMessageLogContext &context, const QString &msg)
{
QByteArray localMsg = msg.toLocal8Bit();
const char *file = context.file ? context.file : "";
const char *function = context.function ? context.function : "";
switch (type) {
case QtDebugMsg:
//fprintf(stderr, "Debug (%s:%u) %s: %s\n", file, context.line, function, localMsg.constData());
break;
case QtInfoMsg:
fprintf(stderr, "Info (%s:%u) %s: %s\n", file, context.line, function, localMsg.constData() );
break;
case QtWarningMsg:
//fprintf(stderr, "Warning (%s:%u) %s: %s\n", file, context.line, function, localMsg.constData());
break;
case QtCriticalMsg:
fprintf(stderr, "Critical (%s:%u) %s: %s\n", file, context.line, function, localMsg.constData());
break;
case QtFatalMsg:
fprintf(stderr, "Fatal (%s:%u) %s: %s\n", file, context.line, function, localMsg.constData());
break;
}
}
int main(int argc, char *argv[])
{
qInstallMessageHandler(messageOutput);
... <rest of your main.cpp> ...
}
So instead of using fprintf
as I do in this example - you'd send a QString off to your QML object instead.
from qtfirebase.
What do you mean by "send a QString off to your QML"? I would replace fprintf with MyClass.MyQString = context.line.
Or you are referring to my main QML object that it is always a QQuickView?
`QQuickView *view = new QQuickView;
MyClass clss;
view->rootContext()->setContextProperty("MyClass", &clss);
view->setSource(QUrl("qrc:/Init.qml"));
view->setResizeMode(QQuickView::SizeRootObjectToView);
view->show();
return app.exec();`
Thank you, appreciate your master explanation and help
from qtfirebase.
Whatever works I guess.
You could probably send messages via a SingletonInstance also - there's many ways to do it I think.
If the way you're doing it currently, works - I guess there's no need to fix it 😉
from qtfirebase.
Ok, perfect and thanks again
from qtfirebase.
@Trikos I'm glad to help 🙂
from qtfirebase.
Related Issues (20)
- Using Qtfirebase HOT 13
- Cloud Storage HOT 5
- Getting Value from Firebase Real-time Database (Qt c++) HOT 1
- QString::sprintf was removed in Qt 5.14.x? HOT 11
- Support for Android AAB (Armv7 & Armv8) HOT 6
- Compatible Firebase SDK versions HOT 1
- Not able to Create QtFirebase object in my main.qml for Android. HOT 2
- Links markdown broken HOT 1
- Bundle of improvements HOT 3
- Provide a CLI to be run qmake HOT 13
- Code signing error HOT 5
- Push notifications while in foreground HOT 9
- Can't compile with QTFIREBASE_CONFIG += analytics messaging for iOS HOT 2
- Qt 6 Support ? HOT 1
- Subscribing to topic nets no result HOT 6
- Linking failed on iOS HOT 10
- Build project with CMakeLists.txt instead of .pro HOT 2
- Subscribe method isn't working on the latest firebase_cpp_sdk (10.0.0) HOT 1
- Qt create how to config my kit HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from qtfirebase.