Files
c-evo-evo/common/Forms/include/Cevo/FormKeyShortcuts.h
T

48 lines
1.1 KiB
C++

#pragma once
#include "Cevo/FormBase.h"
#include <QList>
#include <QPointer>
class QObject;
QT_BEGIN_NAMESPACE
namespace Ui {
class FormKeyShortcuts;
}
QT_END_NAMESPACE
namespace Cevo {
// Equivalent of FormKeyShortcuts.pas's TFormKeyShortcuts: lists every
// QAction found (recursively) under a set of source objects, with its
// shortcut, double-click/Enter to trigger it. Column sorting uses
// QTreeWidget's native header-click sorting - no ListViewSort port needed.
class FormKeyShortcuts : public FormBase {
Q_OBJECT
public:
explicit FormKeyShortcuts(QWidget *parent = nullptr);
~FormKeyShortcuts() override;
// Equivalent of LoadFromComponent: objects whose QAction children (found
// recursively) should be listed.
void setSourceObjects(const QList<QObject *> &objects) { m_sourceObjects = objects; }
void setMainWindow(QWidget *window) { m_mainWindow = window; }
protected:
void showEvent(QShowEvent *event) override;
private slots:
void onExecuteSelected();
private:
void reload();
Ui::FormKeyShortcuts *ui;
QList<QObject *> m_sourceObjects;
QPointer<QWidget> m_mainWindow;
};
} // namespace Cevo