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. Shouldn't on<PropertyName>Changed() signal pass the property value as parameter ?
Forum Updated to NodeBB v4.3 + New Features

Shouldn't on<PropertyName>Changed() signal pass the property value as parameter ?

Scheduled Pinned Locked Moved General and Desktop
2 Posts 2 Posters 1.2k 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.
  • F Offline
    F Offline
    finetjul
    wrote on last edited by
    #1

    Hi,
    In QML, a signal is created for every declared property.
    I have not found in the documentation whether the signal (on<PropertyName>Changed) passes or not the new property value.
    That would be convenient when connecting such signal with slots that don't know where the signal comes from.
    I don't see any drawback to that option (besides naming scope).
    Any thoughts ?
    Thanks

    1 Reply Last reply
    0
    • JKSHJ Offline
      JKSHJ Offline
      JKSH
      Moderators
      wrote on last edited by
      #2

      Hi,

      Good thinking.

      C++ property change signals pass the new property value, but QML property change signals do not. The C++ QSlider has a valueChanged(int) signal, but the QML Slider only has a valueChanged() signal.

      I agree that it would be nice if QML signals are like C++ signals. I'm guessing that it has been designed this way because QML property change signal handlers are usually in the object that owns the property, so it's easy to access them anyway. It would be interesting to know how often these signals are connected to external objects.

      You can bring this idea to Qt engineers my posting to https://bugreports.qt-project.org/ or http://lists.qt-project.org/mailman/listinfo/development (you need to create an account for the first one, and subscribe for the second one). However, I don't know if it's possible to make this change without breaking existing programs, and without cluttering QML objects with extra signals. Implementing this might have to wait until Qt 6.

      Note: on<PropertyName>Changed() is the signal handler (slot). The signal is <propertyName>Changed()

      Qt Doc Search for browsers: forum.qt.io/topic/35616/web-browser-extension-for-improved-doc-searches

      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