Chenna V
Chenna V

Reputation: 10523

Find if a QWidget belongs to a layout or not?

Given a QWidget pointer, is it possible to determine if it belongs to any layout or not? I don't have access to the layout, the only thing I have is the QWidget* [Tricks and hacks are accepted :)]

Thank you. CV

Upvotes: 0

Views: 1033

Answers (1)

Andrii
Andrii

Reputation: 1906

I think you are looking for int QLayout::indexOf(QWidget * widget) const (link).

Or use QLayout::itemAt(int index) const recursively, if you want look at a child layouts too (link).

Upvotes: 1

Related Questions