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

Not possible to bind Action's enabled property to activeFocus of TextArea

    XMLWordPrintable

Details

    Description

      Originally noticed here. That comment explains the problem in greater detail.

      Steps to reproduce:

      1. Click in mainTextArea to give it focus
      2. Open the Edit menu
      3. Select All is disabled
      import QtQuick
      import QtQuick.Controls
      import QtQuick.Layouts
      
      ApplicationWindow {
          id: window
          width: 380
          height: 320
          visible: true
      
          menuBar: MenuBar {
              Menu {
                  title: qsTr("Edit")
      
                  Action {
                      text: qsTr("Some Other Action")
                  }
                  Action {
                      text: qsTr("Select All")
                      shortcut: StandardKey.SelectAll
                      enabled: mainTextArea.activeFocus
                      onTriggered: mainTextArea.selectAll()
                  }
              }
          }
      
          SplitView {
              anchors.fill: parent
      
              TextArea {
                  SplitView.minimumWidth: 100
              }
      
              TextArea {
                  id: mainTextArea
                  text: "Test text"
      
                  SplitView.fillWidth: true
              }
          }
      }
      

      Compare this to widgets' correct behaviour, which can be seen in e.g. Creator.

      Attachments

        Issue Links

          No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

            People

              qt.team.quick.subscriptions Qt Quick and Widgets Team
              mitch_curtis Mitch Curtis
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:

                Gerrit Reviews

                  There are no open Gerrit changes