Good looking app wihout QtQuick?
Hi.
I have to make an application that would use C++ and QSerialPort (smart house system) and look minimalistic and user-friendly (like QtQuick apps).
Should I go for the QtQuick and (somehow???) connect it to the QWidget classes (or backwards - QtQuick UI to QWidget project) or is there a good way to make an phone-like app with QtWidget?
Thank You in advance.
Re: Good looking app wihout QtQuick?
If you want a phone like app, then you definitely want to go with QtQuick.
Any reason you can't use it?
Cheers,
_
Re: Good looking app wihout QtQuick?
Well I am new to Qt and especially QtQuick, so I don't know how to, f.e. make a MouseArea that will onclicked send signal to main.cpp to use a function that will return a number between 0 and 5, then print the number into a QtQuick Text field. I am trying to do something with QQmlProperty. I have smth like
Code:
QQmlApplicationEngine engine2;
QQmlEngine engine;
QQmlComponent component
(&engine,
QUrl::fromLocalFile("/home/smth/main.qml"));
QObject *object
= component.
create();
QObject *rect
= object
->findChild<QObject
*>
("applicationWindow1");
}
How do I add smth like
Code:
rect->setProperty("visibility", "FullScreen");
to applicationWindow1
or change a Text field in smth like.
Code:
name->setProperty("thisisthename")
Or in any other way i need to make a connection between QML and .cpp files.
Re: Good looking app wihout QtQuick?
That's way to complicated.
Just use the QQmlApplicationEngine with a Window in the QML file or a QQuickWindow.
In either case prepare a QObject derived class as the interface that your C++ offers to QML.
Create an object of that class before loading the QML into the engine/view and set it via the root context's setContextPropery() method.
Any slot or Q_INVOKABLE marked method on that object can then be called from QML.
Cheers,
_