LeechCraft 0.6.70-16373-g319c272718
Modular cross-platform feature rich live environment.
Loading...
Searching...
No Matches
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
11namespace 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}
void CreateShortcuts(const QList< QKeySequence > &shortcuts, const std::function< void()> &func, QWidget *parent)
Makes func invokable with shortcuts in seq.
Definition util.cpp:13