Skip to content
This repository has been archived by the owner on Oct 15, 2024. It is now read-only.

Hight Error when use `` #165

Closed
yyk123 opened this issue Nov 15, 2021 · 2 comments
Closed

Hight Error when use `` #165

yyk123 opened this issue Nov 15, 2021 · 2 comments
Assignees
Labels
bug Something isn't working

Comments

@yyk123
Copy link

yyk123 commented Nov 15, 2021

such as:
Screenshot from 2021-11-15 11-35-58

@seanwu1105 seanwu1105 self-assigned this Nov 15, 2021
@seanwu1105 seanwu1105 added the bug Something isn't working label Nov 15, 2021
@seanwu1105
Copy link
Owner

@yyk123 Can you provide the minimal sample QML file to reproduce the issue? It works with the following script.

import QtQuick 2.1

Item {
    function fibonacci(n){
        var arr = [0, 1];
        for (var i = 2; i < n + 1; i++)
            arr.push(arr[i - 2] + arr[i -1]);

        return arr;
    }
    
    TapHandler {
        onTapped: console.log(fibonacci(10))
    }
    Rectangle {
        property color previousColor
        property color nextColor
        onNextColorChanged: console.log("The next color will be: " + nextColor.toString())
    }
}

Screenshot from 2021-12-02 15-55-16

@yyk123
Copy link
Author

yyk123 commented Dec 13, 2021

UserButton {
    id: plotButton
    x: typeColumnLayout.x + 20
    y: typeColumnLayout.y + typeColumnLayout.height + 20
    width: 60
    height: 35
    font.pixelSize: topItem.pixelSize + 1
    Layout.alignment: Qt.AlignHCenter | Qt.AlignVCenter
    text: checked? qsTr("停止") : qsTr("绘图")
    checkable: true
    isDark: UserTheme.isDark
    textColor: UserTheme.button.textColor
    backgroundColor: UserTheme.button.backgroundColor
    borderColor: UserTheme.button.borderColor
    property bool waiting: false
    onClicked:                              
    { 
        if(!waiting)
        {
            waiting = true
            if(checked)
            {
                
                for(let [key, value] of ObjCreation.objs)
                {
                    log.write(Verbose.Debug, `Charts Object: ${key}`)
                    value.show() 
                }

                log.write(Verbose.Debug, "try start plot thread.")
                let type = 0
                if(iqRadioButton.checked)
                {
                    type = type | PlotType.IQ
                }

                if(phaseRadioButton.checked)
                {
                    type = type | PlotType.Phase
                }

                if(specturmRadioButton.checked)
                {
                    type = type | PlotType.Spectrum
                }

                if(distRadioButton.checked)
                {
                    type = type | PlotType.Dist
                }

                if(velRadioButton.checked)
                {
                    type = type | PlotType.Vel
                }
                plot.start(type)
                waiting = false
            }
            else
            {
                log.write(Verbose.Debug, "try close plot thread.")
                for(let [key, value] of ObjCreation.objs)
                {
                    log.write(Verbose.Debug, `Close Charts Object: ${key}.`)
                    value.close()
                }
                checked = true
                plot.stop()
            }
        }
        else
        {
            log.write(Verbose.Debug, "plot thread busy, waiting")
            checked = ~checked
        }
    }
}

I figured it out.

It caused by this format:

 onClicked:                              
    { 

change to

 onClicked: { 

works fine.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants