// m_historyLayout是某成员的父组件,假设在其有一个表,将其遍历出.
for (int cc = m_historyLayout->layout()->count(); cc >= 0; --cc)
{
QLayoutItem *it = m_historyLayout->layout()->itemAt(cc);
QTableWidget *orderHistory = qobject_cast<QTableWidget *>(it->widget());
if (orderHistory != 0)
{
//doing something for orderHistory
}
}
QT-从QLayout中遍历出组件(Widget)
最新推荐文章于 2024-12-27 16:48:59 发布