What I’d like to do is make sure the mouse focus is in the Replace Text Field as soon as the UI is brought up so I can basically click the button, type what I want, and hit enter.
does anyone know how to set the focus in a LineEdit field?
So here, instead of using the Dialog, I created it myself from scratch. Means that you can control everything.
You can also go further, imagine selecting your nodes, launching the script, you type what you want because you are already in the good lineEdit, and then with an event listener, you can validate by pressing Enter or whateverelse.
It would be : select, type, enter.
Hah! holy crap, that’s awesome! thanks so much eAthis!
I had to comment out the line:
myUi.setWindowFlags(Qt.FramelessWindowHint);
because it was creating the window on my other monitor, and I couldn’t move it… heh
But this is awesome!
Another quick question - with this is there a way to make hitting the ENTER key execute the findAndReplace function? This way you don’t have to move your mouse at all, you just hit it, type, and done!
Heya! Sorry it took me so long to do this, but I’ve put up a github repo with some of the scripts I’ve been working on - including the one you helped with!
I just stumbled upon this thread and this is pretty fascinating! I’ve used an external dialog file made with QT Creator before as well as used widgets but never made a dialog from scratch just out of code. That’s pretty brilliant!
I’m trying to do something a bit complicated and I haven’t found the answer yet. Do you know if there is a way for the dialog to not set the focus but detect it when it comes back to the dialog?
In other words, I have this dialog that sits on top of the interface, allowing for some actions. What I would like is to be able to change my selection in toonboom and when I go back to my dialog to perform a new action, for it to display some info about the new selection. I am currently using a button to do that, but it’s not so clean. I would like to detect when the dialog comes back into focus and run an update function at that time. Any idea if this is possible? I’ve looked for a focus related signal to connect my fonction to but so far no luck.
Thank you in advance, and to jasonschleifer as well for his repo and starting this great conversation!
So I managed to make it work.
When I do a selection in the node view then launch the script, the label in the QWidget shows me how many selected nodes I have.
Then if I lose focus, select more or less nodes then click on the QWidget to set the focus back on it, it automatically updates the label and shows me the number of selected nodes.
I’m learning an awful lot about QTUI thanks to you!
I hope I can make my scripts available in the future as a way to say thanks!
You should make a developers blog about the intricacies of toonboom scripting, that would be so interesting. Kind of like what Ajar Productions was to Flash scripting back in the day!