Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. QML Popup in QWidget Application with focus
Forum Updated to NodeBB v4.3 + New Features

QML Popup in QWidget Application with focus

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
4 Posts 3 Posters 477 Views 1 Watching
  • 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.
  • W Offline
    W Offline
    Wolosocu
    wrote on 25 Nov 2023, 23:28 last edited by Wolosocu
    #1

    09aaa32c-29e4-4514-a312-2a9d881c8c1d-image.png

    Here is a screenshot of my app, which (for right now), is mostly a QWidget application. As you can see, two of the three main panes are a QWidget controls and the main one is a QQuickWidget control.

    The dialog that says "This is the description" is displayed in a Popup that springs up from the bottom (the rest of that pane behind the popup is a QML Item). However for some reason I'm unable to type into the box.

    The same QML code works here: https://tinyurl.com/yq9cela5

    When I press a key, the control in the second pain is highlighting an item in the list that begins with the letter I've typed, as though it has focus. However the QuickWidget definitely has focus and I can't figure out why I can't type in the box.

    There is no special code trapping keystrokes or forcing focus onto the middle pane, and I'm having trouble figuring out why I can't type in the Popup.

    Does anyone have any suggestions?

    J 1 Reply Last reply 26 Nov 2023, 04:53
    0
    • W Wolosocu
      25 Nov 2023, 23:28

      09aaa32c-29e4-4514-a312-2a9d881c8c1d-image.png

      Here is a screenshot of my app, which (for right now), is mostly a QWidget application. As you can see, two of the three main panes are a QWidget controls and the main one is a QQuickWidget control.

      The dialog that says "This is the description" is displayed in a Popup that springs up from the bottom (the rest of that pane behind the popup is a QML Item). However for some reason I'm unable to type into the box.

      The same QML code works here: https://tinyurl.com/yq9cela5

      When I press a key, the control in the second pain is highlighting an item in the list that begins with the letter I've typed, as though it has focus. However the QuickWidget definitely has focus and I can't figure out why I can't type in the box.

      There is no special code trapping keystrokes or forcing focus onto the middle pane, and I'm having trouble figuring out why I can't type in the Popup.

      Does anyone have any suggestions?

      J Offline
      J Offline
      jeremy_k
      wrote on 26 Nov 2023, 04:53 last edited by
      #2

      @Wolosocu said in QML Popup in QWidget Application with focus:

      Here is a screenshot of my app, which (for right now), is mostly a QWidget application. As you can see, two of the three main panes are a QWidget controls and the main one is a QQuickWidget control.

      Have you considered converting the entire UI to QML? Sometimes sticking to one UI technology simplifies the problems.

      The same QML code works here: https://tinyurl.com/yq9cela5

      When I press a key, the control in the second pain is highlighting an item in the list that begins with the letter I've typed, as though it has focus. However the QuickWidget definitely has focus and I can't figure out why I can't type in the box.

      Does anyone have any suggestions?

      Use the Window.activeFocusItem property to visually track which item has focus.

      Window {
          id: root
          Rectangle {
              anchors.fill: root.activeFocusItem
              color: "transparent"
              border { color: "red"; width: 1 }
          }
      }
      

      Install an event filter on the QApplication to monitor focus and key events.

      Asking a question about code? http://eel.is/iso-c++/testcase/

      W 1 Reply Last reply 26 Nov 2023, 17:57
      0
      • J jeremy_k
        26 Nov 2023, 04:53

        @Wolosocu said in QML Popup in QWidget Application with focus:

        Here is a screenshot of my app, which (for right now), is mostly a QWidget application. As you can see, two of the three main panes are a QWidget controls and the main one is a QQuickWidget control.

        Have you considered converting the entire UI to QML? Sometimes sticking to one UI technology simplifies the problems.

        The same QML code works here: https://tinyurl.com/yq9cela5

        When I press a key, the control in the second pain is highlighting an item in the list that begins with the letter I've typed, as though it has focus. However the QuickWidget definitely has focus and I can't figure out why I can't type in the box.

        Does anyone have any suggestions?

        Use the Window.activeFocusItem property to visually track which item has focus.

        Window {
            id: root
            Rectangle {
                anchors.fill: root.activeFocusItem
                color: "transparent"
                border { color: "red"; width: 1 }
            }
        }
        

        Install an event filter on the QApplication to monitor focus and key events.

        W Offline
        W Offline
        Wolosocu
        wrote on 26 Nov 2023, 17:57 last edited by
        #3

        @jeremy_k said in QML Popup in QWidget Application with focus:

        Have you considered converting the entire UI to QML? Sometimes sticking to one UI technology simplifies the problems.

        I have, and I am. But it's a process. I'm trying to do it in pieces so we can still have regular releases. Eventually though I'd like to have the entire app in QML so that I could also compile it to WebAssembly and have it useable as a website.

        1 Reply Last reply
        0
        • R Offline
          R Offline
          rubymamis
          wrote on 30 Jun 2024, 15:59 last edited by
          #4

          I'm facing the same issue. @Wolosocu, did you solve this?

          1 Reply Last reply
          0

          • Login

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