简体   繁体   English

从QML打开Qt窗口

[英]Opening Qt window from QML

I have created a C++ Qt class, inheriting from QWidget. 我创建了一个从QWidget继承的C ++ Qt类。 I have also created a QML file, which runs as my main, and I want in some point of the program to open another separated window containing this widget. 我还创建了一个QML文件,该文件作为我的主文件运行,并且我希望在程序的某个点打开另一个包含此小部件的独立窗口。

The point is to draw line graphs in QML, and I don't quite understand how to do it. 关键是要在QML中绘制折线图,​​但我不太了解该怎么做。

First of all, take a look at this question and its answers: Qt5. 首先,看看这个问题及其答案: Qt5。 Embed QWidget object in QML 在QML中嵌入QWidget对象

You got into XY-problem . 您陷入XY问题 You do not need to embed QWidget to your QtQuick/QML application. 您不需要将QWidget嵌入到QtQuick / QML应用程序中。 (I hope) You can easily deal with your task using only QML. (我希望)您可以仅使用QML轻松处理任务。 For example, there is Canvas Element that can help you to organize drawing. 例如,有“ 画布元素”可以帮助您组织绘图。 Take a look at tutorial related to Canvas in QmlBook . 看看QmlBook中与Canvas相关的教程

Hope this helps! 希望这可以帮助!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM