Problems with Open-Source Downloads read https://www.qt.io/blog/problem-with-open-source-downloads and https://forum.qt.io/post/638946

QML boxes with a transparent background under macOS



  • Hello,

    I use qml boxes that I manage from C++.
    Everything works well but I can't display boxes with a transparent background under macOS. The boxes are displayed correctly under Linux, Windows and Android...
    Is there anything different to do with macOS?

    Thank you!

    Example of display of one of these boxes :

    engine_configuration->rootContext()->setContextProperty("anchor", anchor_configurationQML);
    
    component_configurationQML = new QQmlComponent(engine_configuration);
    component_configurationQML->loadUrl(QUrl("qrc:///qml/configuration.qml"));
    
    anchor_configurationQML->setProperty("param1", param1);
    		
    if (component_configurationQML->isReady())
    {
    	configurationQML = qobject_cast<QQuickWindow*>(component_configurationQML->create());
    
    	configurationQML->setPosition(QPoint(0, QMLdeltaY));
    
    	configurationQML->setFlags(Qt::FramelessWindowHint);
    
    	configurationQML->showNormal();
    }
    

    my qml can looks like this:

    import QtQuick 2.15
    import QtQuick.Window 2.15
    import QtQuick.Controls 2.15
    import QtQuick.Controls.Material 2.15
    import MyLib 1.0
    
    Window {
        id: main2
    
        property double trans: 0.0
        property bool mobile: anchor.Android
        property int h: anchor.Height
        property int posy: 0
        property int timeoutInterval: 50
        signal timeout
    
        modality: Qt.NonModal
    
        visible: false
        visibility: Window.Windowed
        color: "#00000000"
        opacity: trans
        x: 0
        y: 0
        width: 300
        height: h
    
        Flickable {
            id: flickableMain
            anchors.rightMargin: 0
            anchors.leftMargin: 0
            anchors.topMargin: 0
            anchors.bottomMargin: 0
            anchors.fill: parent
            boundsBehavior: Flickable.StopAtBounds
    
            contentWidth: parent.width
            contentHeight: h > 1500 ? h : 1500
    
            width: parent.width
            height: parent.height
    
            Keys.onUpPressed: scrollBar.decrease()
            Keys.onDownPressed: scrollBar.increase()
    
    ....
    

Log in to reply