mirror of
https://github.com/WarmUpTill/SceneSwitcher.git
synced 2026-08-22 17:25:54 -05:00
Add ResourceTable class
Base class to be used to display items in a table
This commit is contained in:
37
lib/utils/resource-table-hotkey-handler.hpp
Normal file
37
lib/utils/resource-table-hotkey-handler.hpp
Normal file
@@ -0,0 +1,37 @@
|
||||
#pragma once
|
||||
#include "export-symbol-helper.hpp"
|
||||
|
||||
#include <map>
|
||||
#include <mutex>
|
||||
#include <QEvent>
|
||||
#include <QObject>
|
||||
|
||||
namespace advss {
|
||||
|
||||
EXPORT void RegisterHotkeyFunction(QWidget *, Qt::Key,
|
||||
std::function<void()> func);
|
||||
EXPORT void DeregisterHotkeyFunctions(QWidget *);
|
||||
|
||||
class ResourceTabHotkeyHandler : public QObject {
|
||||
Q_OBJECT
|
||||
public:
|
||||
static ResourceTabHotkeyHandler *Instance();
|
||||
void RegisterHandler(QWidget *, Qt::Key, std::function<void()> func);
|
||||
void Deregister(QWidget *);
|
||||
|
||||
protected:
|
||||
bool eventFilter(QObject *obj, QEvent *event) override;
|
||||
|
||||
private:
|
||||
struct CallbackData {
|
||||
Qt::Key key;
|
||||
std::function<void()> func;
|
||||
};
|
||||
|
||||
ResourceTabHotkeyHandler() : QObject(){};
|
||||
|
||||
std::multimap<QObject *, CallbackData> _callbacks;
|
||||
std::mutex _mutex;
|
||||
};
|
||||
|
||||
} // namespace advss
|
||||
Reference in New Issue
Block a user