LeechCraft  0.6.70-18450-gabe19ee3b0
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 #include <QWidget>
11 
12 namespace LC::Util
13 {
14  void CreateShortcuts (const QList<QKeySequence>& shortcuts,
15  const std::function<void ()>& func, QWidget *parent)
16  {
17  for (const auto& sc : shortcuts)
18  QObject::connect (new QShortcut { sc, parent },
19  &QShortcut::activated,
20  parent,
21  func);
22  }
23 
24  void CreateShortcuts (const QList<QKeySequence>& shortcuts,
25  QObject *object, const char *metamethod, QWidget *parent)
26  {
27  for (const auto& sc : shortcuts)
28  QObject::connect (new QShortcut { sc, parent },
29  SIGNAL (activated ()),
30  object,
31  metamethod);
32  }
33 }
void CreateShortcuts(const QList< QKeySequence > &shortcuts, const std::function< void()> &func, QWidget *parent)
Makes func invokable with shortcuts in seq.
Definition: util.cpp:14