Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

error with qml



  • import QtQuick 2.4
    import QtQuick.Extras 1.4
    import QtQuick.Controls.Styles.Desktop 1.0
    import Qt.labs.qmlmodels 1.0
    import QtQuick.Shapes 1.11
    import QtCanvas3D 1.1

    Rectangle {

    id: rectangle
    
    width:400
    
    height: 400
    
    
    
    
    
    //transformOrigin: Item.Left
    
    
    
    
    
    CircularGauge {
        id: circularGauge
        y: 60
        anchors.left: parent.left
        anchors.leftMargin: 96
    }
    

    }

    but I have an error:
    StyleItem is not a type
    and
    qrc:/QMl.qml: Type RowItemSingleton unavailable

    and I have:

    Cattura.PNG



  • @vale88

    import QtQuick 2.12
    import QtQuick.Window 2.12
    import QtQuick.Controls 2.12
    import QtQuick.Extras 1.4 
    
    ApplicationWindow {
        id: root
        width: 800
        height: 600
        visible: true
    
        CircularGauge {
            id: circularGauge
            y: 60
            anchors.left: parent.left
            anchors.leftMargin: 96
        }
    }
    

    @vale88 said in error with qml:

    StyleItem

    What is StyleItem ? There is no ref to StyleItem in the code you pasted here. In your qt creator application output tab you should see the line in your code where the error occured

    note: please try to format/ indent you code correctly before you past it, huge spaces around a commented line is fully useless
    please try to provide some explanation with human words about what you are trying to achieve



  • @LeLev said in error with qml:

    import QtQuick 2.12
    import QtQuick.Window 2.12
    import QtQuick.Controls 2.12
    import QtQuick.Extras 1.4

    ApplicationWindow {
    id: root
    width: 800
    height: 600
    visible: true

    CircularGauge {
        id: circularGauge
        y: 60
        anchors.left: parent.left
        anchors.leftMargin: 96
    }
    

    }

    I have an error

    QML debugging is enabled. Only use this in a safe environment.
    QQuickWidget does not support using windows as a root item. 
    
    If you wish to create your root window from QML, consider using QQmlApplicationEngine instead. 
    

    I wrote like you wrote..when two screens open, in one there is mainwindow, and on the other qml..I want it opens in mainwindow

    I wrote:

     ui->quickWidget->setSource(QUrl("qrc:///qml.qml"));
    

Log in to reply