Deactivating underlying items



  • Hi guys,

    I just wonder: is there a simple way to deactivate item containing many widgets, like buttons, text fields etc? I have two items (which are supposed to play the role of screens in my app). One is the main. When some button in item 1 is clicked, I want to move the other item OVER the first one, do what is needed, and then move it out. The problem is that the second item is partially opacious (intendedly), so not only I see the underlying widgets from item 1, but I can also use them (click, type something inside textField etc). Is there any way to deactivate the whole item 1, but to leave it visible? I want to see it through item 2, but I don't want the user to interact with it. Any ideas?

    Ps. I can paste some code here, but it contains only simple movement animations.



  • Seems like a typical State-Transition problem to me...

    Your main application state = MAIN
    When ur button is clicked, you move to state = DO_SOMETHING

    On the transition from MAIN to DO_SOMETHING you can do anything you like with animations, such as opacity, visibility etc.

    See for an example: [https://www.youtube.com/watch?v=UDEhIqCBFE0](link url)
    And of course: Read the documentation about states and transitions :)

    I was looking for this link earlier, that impressed me how easy it is:
    youtube link



  • Thank you for your answer. I am aware of states and transitions (actually I use them a lot in that app). My question was: how to deactivate item, when something is above it, but that something doesnt overlap it tptally. After long struggle, I finally found an answer.

    It turned out, that items have property "enabled", which turns on and off any mouse and keyboard events. So to do what I need, I should add PropertyChanges{target: item1; enabled: true} in "main state" and respectly PropertyChanges{target: item1; enabled: false} in "do something state". Works pretty good:)


Log in to reply
 

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