LeechCraft  0.6.70-15082-g543737046d
Modular cross-platform feature rich live environment.
util.cpp
Go to the documentation of this file.
1 /**********************************************************************
2  * LeechCraft - modular cross-platform feature rich internet client.
3  * Copyright (C) 2006-2014 Georg Rudoy
4  *
5  * Distributed under the Boost Software License, Version 1.0.
6  * (See accompanying file LICENSE or copy at https://www.boost.org/LICENSE_1_0.txt)
7  **********************************************************************/
8 
9 #include "util.h"
10 
11 namespace LC::Util
12 {
13  void CreateShortcuts (const QList<QKeySequence>& shortcuts,
14  const std::function<void ()>& func, QWidget *parent)
15  {
16  for (const auto& sc : shortcuts)
17  QObject::connect (new QShortcut { sc, parent },
18  &QShortcut::activated,
19  parent,
20  func);
21  }
22 
23  void CreateShortcuts (const QList<QKeySequence>& shortcuts,
24  QObject *object, const char *metamethod, QWidget *parent)
25  {
26  for (const auto& sc : shortcuts)
27  QObject::connect (new QShortcut { sc, parent },
28  SIGNAL (activated ()),
29  object,
30  metamethod);
31  }
32 }
util.h
QList< QKeySequence >
LC::Util
Definition: icoreproxy.h:33
LC::Util::CreateShortcuts
void CreateShortcuts(const QList< QKeySequence > &shortcuts, const std::function< void()> &func, QWidget *parent)
Makes func invokable with shortcuts in seq.
Definition: util.cpp:19