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. Controls still respond when opacity is 0?

Controls still respond when opacity is 0?

Scheduled Pinned Locked Moved Solved QML and Qt Quick
3 Posts 2 Posters 698 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.
  • I Offline
    I Offline
    igor_stravinsky
    wrote on last edited by
    #1

    I've been writing my own tab control, which adjusts the opacity of the Qt Quick Control 2 views that each tab controls.

    That successfully hides and shows the views as expected. There are a few, unexpected side-effects, however.

    Some of my controls aren't responding.

    Some controls that are hidden are responding. Today I discovered that a ComboBox on a view with opacity 0 still responds when I click on its location on a different tab.

    My whole tab view construction was predicated on the idea that controls that are in a parent view with opacity of 0 will not respond to clicks. Is this not the case in qml?

    1 Reply Last reply
    0
    • GrecKoG Online
      GrecKoG Online
      GrecKo
      Qt Champions 2018
      wrote on last edited by GrecKo
      #2

      No that's not the case.
      Controls don't respond when they have visible or enabled set to false.

      You could change the visible property instead in your case.
      If you don't want to set the visible property directly (you might want to to animate the opacity to hide a control for example) you could do visible: opacity > 0.

      Note that a visible element will have its geometry ignored by containers like Row or ColumnLayout.

      1 Reply Last reply
      3
      • I Offline
        I Offline
        igor_stravinsky
        wrote on last edited by
        #3

        Ah, now the unexpected behavior I'm seeing makes sense.

        I assume that I only need to change the visibility of the parent Item or Rectangle the tabs are on, and that subviews inherit that property.

        Thanks for the help!

        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