Esempio n. 1
0
void ActionsManager::setupWindowActions(QObject *window)
{
	if (!m_windowActions.contains(window))
	{
		return;
	}

	const QHash<QString, QAction*> actions = m_windowActions[window];
	QHash<QString, QAction*>::const_iterator windowActionsIterator;
	QWidget *widget = qobject_cast<QWidget*>(window);

	for (windowActionsIterator = actions.constBegin(); windowActionsIterator != actions.constEnd(); ++windowActionsIterator)
	{
		if (m_profileShortcuts.contains(windowActionsIterator.key()))
		{
			windowActionsIterator.value()->setShortcuts(m_profileShortcuts[windowActionsIterator.key()]);
		}
		else
		{
			windowActionsIterator.value()->setShortcut(QKeySequence());
		}
	}

	widget->addActions(m_applicationActions.values());
}
Esempio n. 2
0
void ActionsManager::setupWindowActions(QObject *window)
{
	if (!m_windowActions.contains(window))
	{
		return;
	}

	const QHash<QString, QAction*> actions = m_windowActions[window];
	QHash<QString, QAction*>::const_iterator windowActionsIterator;
	QWidget *widget = qobject_cast<QWidget*>(window);

	for (windowActionsIterator = actions.constBegin(); windowActionsIterator != actions.constEnd(); ++windowActionsIterator)
	{
		if (m_profileShortcuts.contains(windowActionsIterator.key()))
		{
			const QList<QKeySequence> keySequences = m_profileShortcuts[windowActionsIterator.key()];
			QList<QShortcut*> shortcuts;

			windowActionsIterator.value()->setShortcut(keySequences.value(0));

			for (int i = 1; i < keySequences.count(); ++i)
			{
				QShortcut *shortcut = new QShortcut(keySequences.at(i), widget);

				connect(shortcut, SIGNAL(activated()), windowActionsIterator.value(), SLOT(trigger()));

				shortcuts.append(shortcut);
			}

			if (!shortcuts.isEmpty())
			{
				m_actionShortcuts[windowActionsIterator.value()] = shortcuts;
			}
		}
		else
		{
			windowActionsIterator.value()->setShortcut(QKeySequence());
		}
	}

	widget->addActions(m_applicationActions.values());
}
Esempio n. 3
0
void QWidgetProto::addActions(QList<QAction *> actions)
{
  QWidget *item = qscriptvalue_cast<QWidget*>(thisObject());
  if (item)
    item->addActions(actions);
}