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. bidirectional property binding
Forum Updated to NodeBB v4.3 + New Features

bidirectional property binding

Scheduled Pinned Locked Moved Solved General and Desktop
3 Posts 2 Posters 305 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.
  • G Offline
    G Offline
    gozag
    wrote on last edited by gozag
    #1

    I have a widget that should only be visible when some other widget is visible. In GTK you would bind the two widget's visible property bidirectionally and it would do the job.
    When one of the widgets is hidden both will be hidden and vice versa.
    https://gtk-rs.org/gtk4-rs/stable/latest/book/g_object_properties.html

    How do I achieve this in Qt?

    1 Reply Last reply
    0
    • G Offline
      G Offline
      gozag
      wrote on last edited by gozag
      #2

      There seems to be documentation about this but it looks very convoluted and it does not work for existing properties? https://doc.qt.io/qt-6/bindableproperties.html

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

        Hi,

        One way to implement what you want is to create a simple event filter and check for QShowEvent and QHideEvent for the widgets of interest and change the visible property of the other widgets accordingly.

        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
        1
        • G gozag has marked this topic as solved on

        • Login

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