コード例 #1
0
bool KviCustomToolBarDescriptor::addAction(const QString & szAction)
{
	KviAction * a = KviActionManager::instance()->getAction(szAction);
	if(a)
	{
		m_pActions->append(new QString(szAction));
		if(m_pToolBar)
			a->addToCustomToolBar(m_pToolBar);
		return true;
	}
	return false;
}
コード例 #2
0
void KviCustomToolBarDescriptor::fillToolBar()
{
	if(m_pActions->count() == 0)
	{
		// force layout of the toolbar
		QApplication::postEvent(m_pToolBar, new QEvent(QEvent::LayoutRequest));
	}
	else
	{
		KviPointerList<QString> dying;
		dying.setAutoDelete(false);
		for(QString * p = m_pActions->first(); p; p = m_pActions->next())
		{
			KviAction * a = KviActionManager::instance()->getAction(*p);
			if(a)
				a->addToCustomToolBar(m_pToolBar);
			else
				dying.append(p);
		}
		for(QString * d = dying.first(); d; d = dying.next())
			m_pActions->removeRef(d);
	}
}