コード例 #1
0
void MainWindow::setCurrentWindow(Window *window)
{
	Window *previousWindow(m_currentWindow);

	m_currentWindow = window;

	for (int i = 0; i < m_standardActions.count(); ++i)
	{
		if (m_standardActions[i] && Action::isLocal(m_standardActions[i]->getIdentifier()))
		{
			const int identifier(m_standardActions[i]->getIdentifier());
			Action *previousAction((previousWindow && previousWindow->getContentsWidget()) ? previousWindow->getContentsWidget()->getAction(identifier) : nullptr);
			Action *currentAction(window ? window->getContentsWidget()->getAction(identifier) : nullptr);

			if (previousAction)
			{
				disconnect(previousAction, SIGNAL(changed()), m_standardActions[i], SLOT(setup()));
			}

			m_standardActions[i]->blockSignals(true);
			m_standardActions[i]->setup(currentAction);
			m_standardActions[i]->blockSignals(false);

			if (currentAction)
			{
				connect(currentAction, SIGNAL(changed()), m_standardActions[i], SLOT(setup()));
			}
		}
	}
}
コード例 #2
0
ファイル: xxxform.cpp プロジェクト: nycholas/c-project
void XxxForm::createActions(void) {
	connect(statusTimer, SIGNAL(timeout()), this, SLOT(timerStatusAction()));

	connect(nextPushButton, SIGNAL(released()), this, SLOT(nextAction()));
	connect(previousPushButton, SIGNAL(released()), this,
			SLOT(previousAction()));

	connect(savePushButton, SIGNAL(released()), this, SLOT(saveAction()));
	connect(saveAndContinueSavingPushButton, SIGNAL(released()), this, SLOT(
			saveAndContinueSavingAction()));
	connect(removePushButton, SIGNAL(released()), this, SLOT(removeAction()));
	connect(cancelPushButton, SIGNAL(released()), this, SLOT(cancelAction()));
}