Thanks for this clarification - very important also for me! Because it means that I can try using it as long as I want. And the fact is that I consider this functionality as rather important for the “customer experience”, and I expect users to miss it if I would drop it.
Meaning specifically: If a filter generates a new attribute, either with a predefined name or with a name that the user specifies with some property, he somehow expects to see that attribute after pressing “Apply”! Otherwise it feels like the filter “has not worked” - even if the new attribute was correctly generated and is now available in the “Variables” combo box for selecting.
An important detail: This automatic switching occurs exactly once and not any more after the user has changed some properties and pressed “Apply” once more.
All this is exactly the behaviour of the “Calculator” filter, and I saw that it is done by calling the SetActiveScalars()
function (or some similar ones if that fits better). However, I also see that with other ParaView filters the behavior is different and exactly the way how I do not want it to be - because of the reason explained above.
The following I write only for other programmers who would struggle with the same next question: How could an explicit switch be triggered after a later “Apply”?
In order to answer this question, I spent far too many hours digging in the codes of ParaView in order to find the place where the “magic” with this switching actually happens - with no success. The point is that from some property widget code I have to do an explicit “preparatory Apply call” in the background, before the user even has a chance to specify an attribute, so I would like to do the automatic switching during the second and not already the first call to RequestData()
, but exactly for this I could not find a way how to achieve it!
The only way I could finally get it done is directly through the Qt widget itself: After finding the “Variables” combo box inside the pqColorToolbar
object, I could directly call setCurrentText()
in that combo box, thus “simulating” a user action.
This is of course not a safe way that will work with future versions of the software in the same way, but it turned out to be the only “emergency solution” that I was able to implement. And the good thing is that right now it works!