Reputation: 81
I have a QSplitter with four QTextEdit widgets inside. I know that I can use QObject::findChildren to receive a list with all the widgets inside a widget (in my case in the QSplitter) but I can't figure it out how to determine which is the current one?
Upvotes: 2
Views: 517
Reputation: 1290
As said in the comments, you were looking for the QTextEdit with the focus, so there are two options, basically:
The main disadvantage of the first approach is that you can't be sure (using it directly) whether that widget belongs to the QSplitter or not. The second approach may sound a bit inefficent, but if your QSplitter does not have many widgets, then it will be perfectly fine.
As pointed in the comments (of the OP), you have chosen the second approach, and I'm the one posting the answer here because the OP didn't have enough reputation to answer his question.
Upvotes: 2