I need to add some features in c++. But I struggle how to properly create my own QML window type. I have tried to subclass QQuickWindow and register my new type and use it in My QML project. But when starting it show error, that I can not set opacity
mywindow.h
#include <QQuickItem>
#include <QQuickWindow>
#include <QWindow>
#include <QApplication>
#include <QObject>
class MyWindow : public QQuickWindow {
Q_OBJECT
public:
MyWindow(QQuickWindow *parent=nullptr);
public slots:
Q_INVOKABLE void mycppFeature();
mywindow.cpp
#include "reminderwindow.h"
MyWindow::MyWindow(QQuickWindow *parent):QQuickWindow(parent){
}
main.cpp
qmlRegisterType<MyWindow>("com.organization.my", 1, 0, "MyWindow");
SplashWindow.qml
import QtQuick 2.0
import QtQuick.Controls 2.5
import QtQuick.Window 2.15
import com.organization.my 1.0
MyWindow{
opacity: 0.8
MyWindow is find but the error is "MyWindow.opacity" is not available in com.organizatino.my 1.0. I believe I do not know how to properly subclass the QML Window type. I use it besides the main ApplicationWindow When I use it without opacity, it works properly