If I want to switch between screens, do I also need to set `enabled` or is `visible` enough



  • Hi,

    I have a very basic question. I have a main.qml looking like this:

    ApplicationWindow {
      visible: true
      width: 1024
      height: 600
      Screen1 {
        id: screen1
        visible: true
      }
      Screen2 {
        id: screen2
        visible: false
      }
      Screen3 {
        id: screen3
        visible: false
      }
     ....
    

    The Screen objects fill the screen and represent what is visible on a touch screen in a given state of the application. There are buttons, which will switch between those screen. Is it enough, if these buttons only change the visible property of the Screens, or do I also need to set enable of the current screen to false when switching to a new screeen (in order to prevent the wrong screen to catch touch events)?



  • From what I've experienced, visible is enough. It will keep your screen state before you switch to an other screen but I never experienced any problem with touchscreen capture in the background.

    Edit :
    After a little bit of documentation I found this : visible
    "If this property is set to false, the item will no longer receive mouse events, but will continue to receive key events and will retain the keyboard focus if it has been set. (In contrast, setting the enabled property to false stops both mouse and keyboard events, and also removes focus from the item.)"


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.