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

QML Dialog: title cannot be set dynamically

    XMLWordPrintable

    Details

    • Platform/s:
      Windows
    • Commits:
      1edf84eff083eb5412b4c5c7cd3bd8166f15f61f (qt/qtquickcontrols/5.12)

      Description

      For Dialog (QtQuick.Dialogs 1.3) title, user is able to set it dynamically. whereas Label text can be set easily.

      In Below code, Title for Dialog is not getting set when a function is used.

      Dialog {
          function newTitle(){
                  return "new text";
              }
          id: textDialog
          visible: true
          title: newTitle() // Does not work
      // title : "title123" //This works fine
          onAccepted: {console.log(title)}
          width:500
          contentItem.width: 500;
          contentItem.implicitWidth: 500;
              Label {
                  text: newTitle()
                  anchors.fill: parent
                  wrapMode: Text.WrapAtWordBoundaryOrAnywhere
              }
      }
      
      

      Refer to the attached sample code. You can see that title for dialog does not get set to return value of newTitle()

        Attachments

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

          Activity

            People

            Assignee:
            andysh Andy Shaw
            Reporter:
            shmittal Shveta Mittal
            Votes:
            1 Vote for this issue
            Watchers:
            4 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:

                Gerrit Reviews

                There are no open Gerrit changes