QT-从QLayout中遍历出组件(Widget)

// 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
		}
	}

你可能感兴趣的:(C++,c,C#,qt)