Unsolved OpenGL Content under SplitView
-
Hello guys
based on This SplitView is a layout that will split contents and separate them with a draggable splitter
I used This to load OpenGL Content in QML
But something weird happened
and SplitView don't Split the 3D Contents in separated layoutImage: (as you can see OpenGL content is underneath all SplitView)
It should be placed in the left side of the SplitView
In the right side I have a transparent Rectangleas you can see the Note Rectangle and Text are in right layout but the OpenGL is not
Code: main.qml
import QtQuick 2.13 import QtQuick.Controls 2.13 Item { id: main width: 720 height: 600 SplitView { id: splitView anchors.fill: parent handle: Rectangle { implicitWidth: 4 implicitHeight: 4 color: SplitHandle.pressed ? "#81e889" : (SplitHandle.hovered ? Qt.lighter("#c2f4c6", 1.1) : "#c2f4c6") } GL { implicitWidth: 250 } Rectangle { implicitWidth: 350 SplitView.minimumHeight: 250 color: Qt.rgba(0.0, 1.0, 0.0, 0.1) Text { anchors.fill: parent wrapMode: Text.WordWrap text: "Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello " } } } }
GL type is another GL.qml
import QtQuick 2.13 import OpenGLUnderQML 1.0 Item { id: lView Squircle { anchors.fill: parent SequentialAnimation on t { NumberAnimation { to: 1; duration: 2500; easing.type: Easing.InQuad} NumberAnimation { to: 0; duration: 2500; easing.type: Easing.InQuad} loops: Animation.Infinite running: true } } Rectangle { color: Qt.rgba(1, 1, 1, 0.7) radius: 5 border.width: 1 border.color: "white" anchors.fill: label anchors.margins: -10 } Text { id: label color: "black" wrapMode: Text.WordWrap text: "The background here is a squricle rendered with raw OpenGL using the 'beforeRender()' signal in QQuickWindow. This text label and its border is rendered using QML" anchors.right: parent.right anchors.left: parent.left anchors.bottom: parent.bottom anchors.margins: 20 } }
OpenGLUnderQML come from https://doc.qt.io/qt-5/qtquick-scenegraph-openglunderqml-example.html
and this is main.cpp
#include <QtQuick/QQuickView> #include <QtWidgets/QApplication> #include <QtCore/QUrl> #include <QtQml/QtQml> #include "squircle.h" int main(int argc, char *argv[]) { QApplication app(argc, argv); qmlRegisterType<Squircle>("OpenGLUnderQML", 1, 0, "Squircle"); QQuickView view; view.setResizeMode(QQuickView::SizeRootObjectToView); view.setSource(QUrl("qrc:/main.qml")); view.show(); return app.exec(); }
I don't know it is related to the way OpenGL content is rendered? or it should be behave like an Item (like Rectangle) after registering?!
Would be appreciated for any help
thanks