Example #1
0
	bool event(QEvent * e) override
	{
		if (e->type() == QEvent::Shortcut)
		{
			auto se = static_cast<QShortcutEvent *>(e);
			auto focusWidget = QApplication::focusWidget();
			if (se->isAmbiguous() && focusWidget != nullptr)
			{
				for (const auto& action : QtMenu::sharedQActions_)
				{
					auto qAction = action.second.lock();
					if(!qAction)
					{
						continue;
					}
					bool keyMatches = qAction->shortcut() == se->key();
					bool isContextual = qAction->shortcutContext() == Qt::WidgetShortcut;
					auto associatedWidgets = qAction->associatedWidgets();
					if (!keyMatches || !isContextual)
					{
						continue;
					}
					for(auto& widget : associatedWidgets)
					{
						if(widget == focusWidget && qAction->isEnabled() && qAction->isVisible())
						{
							qAction->trigger();
							return true;
						}
					}
				}
			}
		}
		return QAction::event(e);
	}
Example #2
0
int KmerAffect::getStrand() const{
  if (isUnknown() || isAmbiguous())
    return 0;
  return affect_strand(affect);
}
Example #3
0
bool KmerAffect::isGeneric() const {
  return !(isUnknown() || isAmbiguous());
}
Example #4
0
// Returns true if c is a valid symbol in this alphabet
bool IUPAC::isValid(char c)
{
    return isUnambiguous(c) || isAmbiguous(c);
}