Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt for Python
  4. App crashes on QCheckBox.setChecked()
QtWS25 Last Chance

App crashes on QCheckBox.setChecked()

Scheduled Pinned Locked Moved Solved Qt for Python
3 Posts 2 Posters 754 Views
  • 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.
  • M Offline
    M Offline
    midnightdim
    wrote on last edited by midnightdim
    #1

    I ran into a very strange issue. There was some code including some QCheckBox.setChecked(True) calls for the checkboxes added to the context menu.
    Everything worked fine.
    Then I changed an unrelated part of the code and suddenly that code stopped working - the app simply crashes with no error, I confirmed that this happens on the line with setChecked(True).
    The app also crashes silently when I check such checkbox manually in the context menu.

    My code is too big to post it here. Is there any way to debug what happens behind the scenes in PySide6? Any idea why setChecked() could crash?

    I tried running setChecked() on other checkboxes which are in the layout of the window, and it worked fine, and they can also be manually checked/unchecked.

    jsulmJ 1 Reply Last reply
    0
    • M midnightdim

      I ran into a very strange issue. There was some code including some QCheckBox.setChecked(True) calls for the checkboxes added to the context menu.
      Everything worked fine.
      Then I changed an unrelated part of the code and suddenly that code stopped working - the app simply crashes with no error, I confirmed that this happens on the line with setChecked(True).
      The app also crashes silently when I check such checkbox manually in the context menu.

      My code is too big to post it here. Is there any way to debug what happens behind the scenes in PySide6? Any idea why setChecked() could crash?

      I tried running setChecked() on other checkboxes which are in the layout of the window, and it worked fine, and they can also be manually checked/unchecked.

      jsulmJ Offline
      jsulmJ Offline
      jsulm
      Lifetime Qt Champion
      wrote on last edited by
      #2

      @midnightdim Did you debug the app to find the issue? Do you have a stack trace after crash? Are any slots connected to the problematic check boxes and if so what is done there?

      https://forum.qt.io/topic/113070/qt-code-of-conduct

      M 1 Reply Last reply
      1
      • jsulmJ jsulm

        @midnightdim Did you debug the app to find the issue? Do you have a stack trace after crash? Are any slots connected to the problematic check boxes and if so what is done there?

        M Offline
        M Offline
        midnightdim
        wrote on last edited by
        #3

        @jsulm Yes, I did debug it and there was no stack trace, the app just crashed silently.
        But your reply gave me a good hint. I checked the connected slot and found that it uses the index of the old model while it should have been switched to a new proxy model. This solved the issue.
        Thanks a lot for the tip!

        1 Reply Last reply
        1

        • Login

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