Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Bug with Bug on QML/JS Reformat File? , forEach function is deleted

Bug with Bug on QML/JS Reformat File? , forEach function is deleted

Scheduled Pinned Locked Moved Unsolved General and Desktop
1 Posts 1 Posters 120 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J Offline
    J Offline
    JRobles
    wrote on 4 Jun 2020, 18:07 last edited by
    #1

    jrrobles79@gmail.com said:

    I have the next function:

     onAdditionInfoFetched:{
                 //(var info)
                if(!isCurrentStackPage){
                    return;
                }
                var msgs = []
                info.forEach(element => {
                                 var indexOf = messagesListModel.indexOf("tdid", element.tdid)
                                 if (element.type === 0 && indexOf === -1) {
                                     msgs.push(element)
                                 }
                             } );
                root.messages = root.messages.concat(msgs)
                root.messagesChanged()
                //listView.positionViewAtEnd()
            }
    

    when I call the Tools > QML/JS > reformat file, the function is changed to this:

     onAdditionInfoFetched: {
                //(var info)
                if (!isCurrentStackPage) {
                    return
                }
                var msgs = []
                info.forEach(function element } // <= all the code inside is deleted
                var indexOf = messagesListModel.indexOf("tdid", element.tdid)
                if (element.type === 0 && indexOf === -1) {
                    msgs.push(element)
                }
            })
                root.messages = root.messages.concat(msgs)
                root.messagesChanged()
                //listView.positionViewAtEnd()
            }
    

    The inner function on the forEach is removed and is now giving me an error

    1 Reply Last reply
    0

    1/1

    4 Jun 2020, 18:07

    • Login

    • Login or register to search.
    1 out of 1
    • First post
      1/1
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Get Qt Extensions
    • Unsolved