Closed dorukotiv closed 8 months ago
Hi, thank you for your interest in CXX-Qt.
Can you please provide more detail about the issue.
What code are you currently running? What's the error you get?
And are you using the stable version of CXX-Qt (0.6), or working with the main
branch?
Creating multiple windows using QML should work as it does in any other Qt/QML application.
Please note that if your window isn't the root item of your QML file, you may have to explicitly call show
on it.
Example:
import QtQuick 2.15
import QtQuick.Controls 2.15
import QtQuick.Window 2.15
Item {
Component.onCompleted: {
window1.show()
window2.show()
}
ApplicationWindow {
id: window1
height: 480
title: qsTr("First Window")
visible: true
width: 640
Label {
anchors.fill: parent
text: "Hello world"
}
}
ApplicationWindow {
height: 480
title: qsTr("Second Window")
visible: true
width: 640
id: window2
Label {
anchors.fill: parent
text: "Hello world"
}
}
}
Hi, thank you for your interest in CXX-Qt.
Can you please provide more detail about the issue. What code are you currently running? What's the error you get? And are you using the stable version of CXX-Qt (0.6), or working with the
main
branch?Creating multiple windows using QML should work as it does in any other Qt/QML application. Please note that if your window isn't the root item of your QML file, you may have to explicitly call
show
on it.Example:
import QtQuick 2.15 import QtQuick.Controls 2.15 import QtQuick.Window 2.15 Item { Component.onCompleted: { window1.show() window2.show() } ApplicationWindow { id: window1 height: 480 title: qsTr("First Window") visible: true width: 640 Label { anchors.fill: parent text: "Hello world" } } ApplicationWindow { height: 480 title: qsTr("Second Window") visible: true width: 640 id: window2 Label { anchors.fill: parent text: "Hello world" } } }
Thanks for the answer, that is enough for my question!
However, the issue I had with this is that when I look at a solution to my problem, I find C++ solutions and I panic that it doesn't exist in CXX-Qt. How should I address my problems? If a solution is in C++ code, can I somehow use this solution or should I go through Qt solutions first?
Happy to hear that works :)
Some C++ solutions may indeed not work with CXX-Qt immediately. Our goal is not to provide a complete Qt API. Rather we want to give you the tools you need to add the missing bits and pieces yourself.
Take a look at https://cxx.rs/ , which explains the foundation on which CXX-Qt is built. The basic idea is that CXX allows you to make C++ code callable in Rust and vice versa. CXX-Qt expands this functionality so that you can add QObjects in Rust. So you can try wrapping bits of C++ that you need yourself and calling them from Rust.
It's also possible to mix C++ and Rust with CXX-Qt.
Take a look at the qml-minimal
example, which uses a main.cpp
, instead of a Rust file.
That should work for pretty much all cases where C++ is normally used.
Hello,
I am struggling on spawning multiple windows from a one application. Is there a way to do that?