Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-85077

qmlformat: Removes needed braces

    XMLWordPrintable

Details

    • df1f4c9a9f3e3c60fdd43513fdc4926c0cbaa553 (qt/qtdeclarative/dev) eb2e53ae81239b561022940db27e65c23506450c (qt/qtdeclarative/5.15)

    Description

      Tried qmlformat on our sources. Looks like it is confused with that snippet.

      Item {
          onReleased: {
              if (didDrag) {
                  if (contentX > actionOpenOffset / 2) {
                      contentX = 0
                  } else if (deleteOffsetReached) {
                      contentX = drag.minimumX
                  } else {
                      contentX = actionOpenOffset
                  }
              } else if (downOnContent) {
                  if (isActionOpen) {
                      contentX = 0
                  } else {
                      baseItem.clicked()
                  }
              } else if (downOnAction) {
                  baseItem.actionClicked()
                  }
          }
      }
      

      It will format to this:

      Item {
          onReleased: {
              if (didDrag)
                  if (contentX > actionOpenOffset / 2)
                      contentX = 0;
                  else if (deleteOffsetReached)
                      contentX = drag.minimumX;
                  else
                      contentX = actionOpenOffset;
      
              else if (downOnContent)
                  if (isActionOpen)
                      contentX = 0;
                  else
                      baseItem.clicked();
      
              else if (downOnAction)
                  baseItem.actionClicked();
      
          }
      }
      

      Another call to that code will result into an error.

      Failed to parse formatted code.
      An error has occurred. Aborting.

      Attachments

        For Gerrit Dashboard: QTBUG-85077
        # Subject Branch Project Status CR V

        Activity

          People

            max.goldstein Maximilian Goldstein
            misery André Klitzing
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes