qt: Use parent-child relation to manage lifetime of OptionsModel object #18424

pull hebasto wants to merge 1 commits into bitcoin:master from hebasto:20200324-options-model changing 1 files +1 −3
  1. hebasto commented at 8:57 PM on March 24, 2020: member

    Both BitcoinApplication and OptionsModel classes are derived from the QObject class, therefore a parent-child relation could be established to manage the lifetime of an OptionsModel object: https://github.com/bitcoin/bitcoin/blob/5236b2e267a58870239673c7ec85e5df0cb8fc8e/src/qt/optionsmodel.cpp#L29-L30

    This PR does not change behavior.

  2. qt: Use parent-child relation to manage lifetime of OptionsModel object
    Both BitcoinApplication and OptionsModel classes are derived from the
    QObject class, therefore a parent-child relation could be established to
    manage the lifetime of an OptionsModel object.
    This commit does not change behavior.
    8e08d00598
  3. fanquake added the label GUI on Mar 24, 2020
  4. Empact commented at 8:43 PM on March 25, 2020: member

    Perhaps also BitcoinApplication#window?

  5. hebasto commented at 9:34 PM on March 25, 2020: member

    @Empact

    Perhaps also BitcoinApplication#window?

    Unfortunately, this is impossible due to QMainWindow expects a parent of the QWidget type. And the BitcoinApplication class is not derived from the QWidget.

    I'd suggest to remove the window from the members of BitcoinApplication class.

  6. jonasschnelli commented at 11:13 AM on April 8, 2020: contributor

    Yeah. Why not. I just find it confusing to find a new but not a delete on the same layer of code when using raw pointers.

  7. hebasto commented at 11:18 AM on April 8, 2020: member

    Yeah. Why not. I just find it confusing to find a new but not a delete on the same layer of code when using raw pointers.

    That is how Qt Object Trees work.

  8. promag commented at 11:46 AM on April 8, 2020: member

    ACK 8e08d005989c6b5f7f05e0a1e0ba84f544a76d01.

  9. jonasschnelli commented at 9:08 AM on May 29, 2020: contributor

    utACK 8e08d005989c6b5f7f05e0a1e0ba84f544a76d01

  10. jonasschnelli merged this on May 29, 2020
  11. jonasschnelli closed this on May 29, 2020

  12. hebasto deleted the branch on May 29, 2020
  13. sidhujag referenced this in commit 0c6ebfa81b on May 31, 2020
  14. Fabcien referenced this in commit f523519184 on Feb 23, 2021
  15. DrahtBot locked this on Feb 15, 2022

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-04-21 18:14 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me