Quick-Turn-Studio / CLionSupportForQt

19 stars 0 forks source link

[Bug]: error QmlTokenType.K_ON or QmlTokenType.T_LEFT_BRACE expected, got ':' #64

Closed huss22us closed 1 year ago

huss22us commented 1 year ago

Plugin

QML Editor

Describe the bug

I have a qml files and using the plugin I got the error "QmlTokenType.K_ON or QmlTokenType.T_LEFT_BRACE expected, got ':'" when updated from version 0.9.9 to version 2023.1.2

here is a code of one of my files

import QtQuick 2.15 import QtQuick.Controls 2.15 import QtQuick.Layouts 1.15 import QtQuick.Controls.Material 2.15 import Qt.labs.qmlmodels 1.0

Pane { id: techNodesFullPanel Layout.fillWidth: true Layout.fillHeight: true

ColumnLayout {
    id: viewTechnodesLayout
    anchors.fill: parent
    visible: true

    Button {
        id: addNewTechNodeButton
        Layout.rightMargin: 20
        Layout.topMargin: 20
        text: qsTr("Add New Technology")
        Material.background: '#000f9f'
        Material.foreground: "#ffffff"
        Layout.alignment: Qt.AlignRight | Qt.AlignTop
        font.weight: Font.ExtraBold
        font.pixelSize: 20
        Layout.preferredHeight: 60
        Layout.preferredWidth: 300
        onClicked : {
                viewTechnodesLayout.visible = false
                newTechnodeLayout.visible = true
        }
    }

    Label {
        id: allTechNodesLabel
        text: qsTr("All Tech Nodes")
        Layout.fillWidth: true
        color: '#000f9f'
        font.pixelSize: 28
        Layout.leftMargin: 20
        Layout.topMargin: 5
        font.weight: Font.ExtraBold
    }

    Pane {
        id: techNodesTableBackground
        Layout.fillWidth: true
        Layout.fillHeight: true
        Layout.topMargin: 10
        Layout.margins: 40
        Material.background: "#FFFFFF"

        HorizontalHeaderView {
            id: techNodesTableHeaderView
            syncView: techNodesTableView
            anchors.top: parent.top
            anchors.left: parent.left
            anchors.margins: 10
            columnSpacing: 40

            property var columnWidths: [400, 1000]
            columnWidthProvider: function (column) { return columnWidths[column] }
            rowHeightProvider: function (row) { return 100 }

            delegate: Text {
                text: display
                Material.foreground: "#ffffff"
                font.weight: Font.ExtraBold
                font.pixelSize: 24
                horizontalAlignment: Text.AlignLeft
                verticalAlignment: Text.AlignVCenter
                color: "#000f9f"
            }
        }

        TableView {
            id: techNodesTableView
            anchors.top: techNodesTableHeaderView.bottom
            model: technodesModel
            anchors.left: parent.left
            anchors.right: parent.right
            anchors.bottom: parent.bottom
            columnSpacing: 40
            anchors.margins: 10
            anchors.topMargin: 0
            delegate: techNodeDelegateChooser

            property var columnWidths: [400, 1000]
            columnWidthProvider: function (column) { return columnWidths[column] }
            rowHeightProvider: function (row) { return 60 }

            DelegateChooser {
                id: techNodeDelegateChooser
                role: "type"
                DelegateChoice {
                    roleValue: "link"
                    delegate: Text {
                        text: qsTr(model.display)
                        horizontalAlignment: Text.AlignLeft
                        verticalAlignment: Text.AlignVCenter
                        font.pixelSize: 18
                        color:  "blue"
                        font.weight: Font.Bold
                        MouseArea {
                            anchors.fill: parent
                            cursorShape: Qt.PointingHandCursor
                            onClicked: mainBackend.view_tech_node(row)
                        }
                    }
                }
                DelegateChoice {
                    roleValue: "text"
                    delegate: Text {
                        text: qsTr(model.display)
                        horizontalAlignment: Text.AlignLeft
                        verticalAlignment: Text.AlignVCenter
                        font.pixelSize: 18
                    }
                }
            }
        }
    }
}

Pane {
    id: newTechnodeLayout
    anchors.top: parent.top
    anchors.left: parent.left
    anchors.right: parent.right
    anchors.bottom: parent.bottom
    anchors.margins: 40
    Material.background: "#FFFFFF"
    visible: false

    ColumnLayout {
        id: newTechnodeColumnLayout
        anchors.fill: parent

        RowLayout {
            id: technodeNameLayout
            Layout.alignment: Qt.AlignLeft | Qt.AlignTop | Qt.AlignRight
            anchors.margins: 10

            Label {
                id:technodeNameLabel
                Layout.alignment: Qt.AlignLeft | Qt.AlignTop
                Layout.margins:10
                text: qsTr("Name:")
                color: '#000f9f'
                Layout.preferredHeight: 60
                Layout.preferredWidth: 200
                font.weight: Font.Bold
                font.pixelSize: 20
                horizontalAlignment: Text.AlignLeft
                verticalAlignment: Text.AlignVCenter
            }

            TextField {
                id: technodeNameTextField
                Layout.fillWidth: true
                Layout.alignment: Qt.AlignTop
                Layout.margins:10
                Layout.preferredHeight: 60
                font.pixelSize: 20
            }
        }

        RowLayout {
            id: technodeRepoPathLayout
            Layout.alignment: Qt.AlignLeft | Qt.AlignTop | Qt.AlignRight
            Layout.margins: 10

            Label {
                id:technodeRepoPathLabel
                Layout.alignment: Qt.AlignLeft | Qt.AlignTop
                Layout.margins:10
                text: qsTr("Repository Path:")
                color: '#000f9f'
                Layout.preferredHeight: 60
                Layout.preferredWidth: 200
                font.weight: Font.Bold
                font.pixelSize: 20
                horizontalAlignment: Text.AlignLeft
                verticalAlignment: Text.AlignVCenter
            }

            TextField {
                id: technodeRepoPathTextField
                Layout.fillWidth: true
                Layout.alignment: Qt.AlignTop
                Layout.margins:10
                Layout.preferredHeight: 60
                font.pixelSize: 20
            }
        }

        RowLayout {
            id: technodeLayersFileLayout
            Layout.alignment: Qt.AlignLeft | Qt.AlignTop | Qt.AlignRight
            Layout.margins: 10

            Label {
                id:technodeLayersFileLabel
                Layout.alignment: Qt.AlignLeft | Qt.AlignTop
                Layout.margins:10
                text: qsTr("Layer ID File:")
                color: '#000f9f'
                Layout.preferredHeight: 60
                Layout.preferredWidth: 200
                font.weight: Font.Bold
                font.pixelSize: 20
                horizontalAlignment: Text.AlignLeft
                verticalAlignment: Text.AlignVCenter
            }

            TextField {
                id: technodeLayersFileTextField
                Layout.fillWidth: true
                Layout.alignment: Qt.AlignTop
                Layout.margins:10
                Layout.preferredHeight: 60
                font.pixelSize: 20
            }
        }

        Button {
            id: submitNewTechNodeButton
            Layout.rightMargin: 20
            Layout.topMargin: 20
            text: qsTr("Submit")
            Material.background: '#000f9f'
            Material.foreground: "#ffffff"
            Layout.alignment: Qt.AlignRight | Qt.AlignTop
            font.weight: Font.Bold
            font.pixelSize: 20
            Layout.preferredHeight: 60
            Layout.preferredWidth: 200
            onClicked: mainBackend.add_tech(technodeNameTextField.text, technodeRepoPathTextField.text,
            technodeLayersFileTextField.text)
        }
    }
}

ColumnLayout {
    id:viewTechNodeDetailsLayout
    anchors.fill: parent
    visible: false

    Label {
        id: techNodeNameLabel
        text: qsTr("TechNode: ")
        Layout.alignment: Qt.AlignLeft | Qt.AlignTop | Qt.AlignRight
        color: '#000f9f'
        font.pixelSize: 28
        Layout.leftMargin: 20
        Layout.topMargin: 25
        font.weight: Font.ExtraBold
    }

    Pane {
        id: techNodeLayersTableViewBackground
        //anchors.top: techNodeNameLabel.bottom
        Layout.fillWidth: true
        Layout.fillHeight: true
        Layout.topMargin: 10
        Layout.margins: 40
        Material.background: "#FFFFFF"

        HorizontalHeaderView {
            id: techNodeLayersTableHeaderView
            syncView: techNodeLayersTableView
            anchors.left: parent.left
            anchors.top: parent.top
            anchors.margins: 10
            columnSpacing: 40

            property var columnWidths: [500, 500, 500]
            columnWidthProvider: function (column) { return columnWidths[column] }
            rowHeightProvider: function (row) { return 100 }

            delegate: Text {
                text: display
                Material.foreground: "#ffffff"
                font.weight: Font.ExtraBold
                font.pixelSize: 24
                horizontalAlignment: Text.AlignLeft
                verticalAlignment: Text.AlignVCenter
                color: "#000f9f"
            }
        }

        TableView {
            id: techNodeLayersTableView
            anchors.top: techNodeLayersTableHeaderView.bottom
            anchors.bottom: addLayerToTechNodeLayout.top
            model: layersModel
            anchors.left: parent.left
            anchors.right: parent.right
            height: 500

            columnSpacing: 40
            anchors.margins: 10
            anchors.topMargin: 0
            delegate: techNodeLayerDelegateChooser

            property var columnWidths: [500, 500, 500]
            columnWidthProvider: function (column) { return columnWidths[column] }
            rowHeightProvider: function (row) { return 60 }

            DelegateChooser {
                id: techNodeLayerDelegateChooser
                role: "type"
                DelegateChoice {
                    roleValue: "text"
                    delegate: Text {
                        text: qsTr(model.display)
                        horizontalAlignment: Text.AlignLeft
                        verticalAlignment: Text.AlignVCenter
                        font.pixelSize: 18
                    }
                }
            }
        }

        RowLayout {
            id: addLayerToTechNodeLayout
            anchors.left: parent.left
            anchors.right: parent.right
            anchors.bottom: parent.bottom
            anchors.topMargin: 10
            anchors.margins: 40

            TextField {
                id: layerIdTextField
                Layout.alignment: Qt.AlignLeft | Qt.AlignTop
                Layout.margins:10
                Layout.preferredHeight: 60
                font.pixelSize: 20
                visible: false
            }

            TextField {
                id: layerNameTextField
                Layout.alignment: Qt.AlignLeft | Qt.AlignTop
                Layout.margins:10
                Layout.preferredHeight: 60
                font.pixelSize: 20
                visible: false
            }

            Button {
                id: addNewLayerButton
                Layout.alignment: Qt.AlignRight | Qt.AlignTop
                Layout.rightMargin: 20
                Layout.topMargin: 20
                text: qsTr("New")
                Material.background: '#000f9f'
                Material.foreground: "#ffffff"
                font.weight: Font.Bold
                font.pixelSize: 20
                Layout.preferredHeight: 60
                Layout.preferredWidth: 200
                onClicked: {
                    if (addNewLayerButton.text == 'New') {
                        layerIdTextField.visible = true
                        layerNameTextField.visible = true
                        addNewLayerButton.text = "Save"
                    } else {
                        mainBackend.add_layer(layerIdTextField.text, layerNameTextField.text)
                    }
                }
            }
        }
    }
}

Connections {
    target: mainBackend

    function onSignalLoadTechNodes() {
        viewTechnodesLayout.visible = true
        newTechnodeLayout.visible = false
        viewTechNodeDetailsLayout.visible = false
    }

    function onSignalViewTechNode(flag, name) {
        if (flag == true) {
            techNodeNameLabel.text =  "TechNode: " + name
            //techNodeLayersTableView.model = layersModel
            viewTechNodeDetailsLayout.visible = true
            newTechnodeLayout.visible = false
            viewTechnodesLayout.visible = false
            layerIdTextField.visible = false
            layerNameTextField.visible = false
            addNewLayerButton.text = "New"
        }
    }
}

}

Reproduction steps

Just update to the latest version and open the file in PyCharm

grabusr commented 1 year ago

Hi Hussein

Thank you for reporting this bug. It seems that it is licence checking issue. We contacted JetBrains to verify that. We will solve it as soon as possible, I hope tomorrow we will upload it to verification, then after JB approval plugin will be available to download.

grabusr commented 1 year ago

Hi @huss22us

We have uploaded new plugin version 2023.1.3 to JB Marketplace. Now we wait for their acceptance. Please let us know if new version fixes your problem.

grabusr commented 1 year ago

Hi @huss22us

Version 2023.1.3 is able to download. Does it fix your problem?

huss22us commented 1 year ago

@grabusr Yes, it is fixed

Thanks