Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QML ApplicationWindow unable to use onActiveChanged
Forum Updated to NodeBB v4.3 + New Features

QML ApplicationWindow unable to use onActiveChanged

Scheduled Pinned Locked Moved Solved General and Desktop
5 Posts 3 Posters 2.4k Views 2 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.
  • V Offline
    V Offline
    valeryz
    wrote on last edited by
    #1

    I am using QT5.7 and Controls 2.0 and I am unable to use onActiveChanged with ApplicationWindow:
    ApplicationWindow {
    id: root
    flags: Qt.WindowStaysOnTopHint | Qt.FramelessWindowHint
    onActiveChanged: {
    //do my stuff
    }
    }
    I am getting
    "Error:qrc:/main.qml:66 "ApplicationWindow.onActiveChanged" is not available due to component versioning.\n"
    I am able to use it with Window, but Window does not support popup dim effect which I need as well.. I do not seem to find anything in documentation on this... I need to be able to detect clicks outside the ApplicationWindow.

    Any help is greatly appreciated

    1 Reply Last reply
    0
    • ? Offline
      ? Offline
      A Former User
      wrote on last edited by
      #2

      Hi! Looks like a bug in the property/revisioning system. You can use the following as a workaround:

      import QtQuick 2.7
      import QtQuick.Controls 2.1
      
      ApplicationWindow {
          id: mainWindow
          visible: true
          width: 640
          height: 480
      
          Connections {
              target: mainWindow
              onActiveChanged: {
                  console.log("onActiveChanged: " + mainWindow.active);
              }
          }
      }
      

      Please file a bug at bugreports.qt.io.

      [Ping @jpnurmi]

      V 1 Reply Last reply
      3
      • ? A Former User

        Hi! Looks like a bug in the property/revisioning system. You can use the following as a workaround:

        import QtQuick 2.7
        import QtQuick.Controls 2.1
        
        ApplicationWindow {
            id: mainWindow
            visible: true
            width: 640
            height: 480
        
            Connections {
                target: mainWindow
                onActiveChanged: {
                    console.log("onActiveChanged: " + mainWindow.active);
                }
            }
        }
        

        Please file a bug at bugreports.qt.io.

        [Ping @jpnurmi]

        V Offline
        V Offline
        valeryz
        wrote on last edited by
        #3

        @Wieland Thank you so much. I can't believe how simple the workaround was... I've been struggling with this one for a while... I'll log a bug

        1 Reply Last reply
        0
        • jpnurmiJ Offline
          jpnurmiJ Offline
          jpnurmi
          wrote on last edited by
          #4

          Hi, this was fixed in the 5.9 branch just a while ago. The fix will be available in Qt 5.9.1.

          V 1 Reply Last reply
          0
          • jpnurmiJ jpnurmi

            Hi, this was fixed in the 5.9 branch just a while ago. The fix will be available in Qt 5.9.1.

            V Offline
            V Offline
            valeryz
            wrote on last edited by
            #5

            @jpnurmi Thank you!

            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