There is a qt5 bug in how the treewidget handles checkboxes in treemode. Nothing critical, does not affect coin control, but the checkboxes appear to be buggy to the user. See inline code comment.
Fixes point 3 of #3840.
Automatic sanity-testing: PASSED, see http://jenkins.bluematt.me/pull-tester/3f2a0172f5295e139e0077d02d26699397a4a19f for binaries and test log. This test script verifies pulls every time they are updated. It, however, dies sometimes and fails to test properly. If you are waiting on a test, please check timestamps to verify that the test.log is moving at http://jenkins.bluematt.me/pull-tester/current/ Contact BlueMatt on freenode if something looks broken.
With Qt 5.0.2 I don't see a difference in behavior with or without this patch. I've tried clicking on a parent checkbox with lots of children, but they go to fully selected in either case.
So probably the problem was introduced later. I'll test with Qt 5.2.x later on.
I havent tested 5.0, only 5.2. But the bug is the same on windows and linux, so its a qt thing.
The added if-statement should be safe, because I explicitly check for the child to be partially selected. This can never happen, unless bug. So if the bug is fixed, the if-statement does not trigger.