LeechCraft  0.6.70-15082-g543737046d
Modular cross-platform feature rich live environment.
util.h
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 #pragma once
10 
11 #include <functional>
12 #include <QShortcut>
13 #include <QList>
14 #include "shortcutsconfig.h"
15 
16 class QKeySequence;
17 class QWidget;
18 class QObject;
19 
20 namespace LC::Util
21 {
37  const std::function<void ()>& func, QWidget *parent);
38 
39  template<typename Obj>
41  Obj *obj, void (Obj::*member) (), QWidget *parent)
42  {
43  for (const auto& sc : seqs)
44  new QShortcut { sc, parent, obj, member };
45  }
46 
64  QObject *object, const char *metamethod, QWidget *parent);
65 }
QList< QKeySequence >
LC::Util
Definition: icoreproxy.h:33
shortcutsconfig.h
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
UTIL_SHORTCUTS_API
#define UTIL_SHORTCUTS_API
Definition: shortcutsconfig.h:16