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. Detect Clicks outside QML Window
QtWS25 Last Chance

Detect Clicks outside QML Window

Scheduled Pinned Locked Moved QML and Qt Quick
3 Posts 2 Posters 1.7k 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.
  • U Offline
    U Offline
    ustulation
    wrote on last edited by
    #1

    How do i detect clicks outside Window {} in QML ?

    @Rectangle {
    id: topLevel

    height: 400; width: 400

    Window {
    id: windowObj

      color: "blue"
      height: 200; width: 200
      onActiveChanged { console.trace() }
    

    }

    Component.onCompleted: windowObj.visible = true
    }
    @

    Suppose I click on some part of *topLevel *outside windowObj.
    onActiveChanged works on Windows but not on MAC.

    {Using: QtQuick 2.1, QtQuick.Window 2.1, QML/Qt 5.2.0}

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      Can you try the latest Qt version to check whether this behavior still occurs ?

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • U Offline
        U Offline
        ustulation
        wrote on last edited by
        #3

        have Qt 5.3.0 on Mac. Does not work. 1 thing i should mention is that the documentation does not mention onActiveChanged for QML Window {} element. It is just that QWindow has it and hence available to QML as well.

        <1> What could be the issue/solution (or maybe there is some other way to do it)

        <2> Actually I am trying to make my own combobox. The DropDown is a Window {} with flag as Qt.Popup (or Qt.SplashScreen which produces less flickering when in full screen mode) which i need to close moment the user clicks anywhere outside it and hence i need to capture such a signal. Do you know of a better way to make such a drop down?

        1 Reply Last reply
        1

        • Login

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