mirror of
https://github.com/YACReader/yacreader
synced 2026-04-12 15:49:53 -04:00
Some checks failed
Build / Initialization (push) Has been cancelled
Build / Code Format Validation (push) Has been cancelled
Build / Linux (Qt6) (push) Has been cancelled
Build / Linux (Qt6 + 7zip) (push) Has been cancelled
Build / macOS (Qt6 Universal) (push) Has been cancelled
Build / Windows x64 (Qt6) (push) Has been cancelled
Build / Windows ARM64 (Qt6) (push) Has been cancelled
Build / Docker amd64 Image (push) Has been cancelled
Build / Docker arm64 Image (push) Has been cancelled
Build / Publish Dev Builds (push) Has been cancelled
Build / Publish Release (push) Has been cancelled
Build / Publish YACReader10 Pre-release Builds (push) Has been cancelled
48 lines
1.3 KiB
C++
48 lines
1.3 KiB
C++
#ifndef EDIT_SHORTCUT_ITEM_DELEGATE_H
|
|
#define EDIT_SHORTCUT_ITEM_DELEGATE_H
|
|
|
|
#include <QItemDelegate>
|
|
#include <QKeyEvent>
|
|
#include <QKeySequence>
|
|
#include <QLineEdit>
|
|
#include <QToolButton>
|
|
|
|
class KeySequenceLineEdit : public QLineEdit
|
|
{
|
|
Q_OBJECT
|
|
public:
|
|
explicit KeySequenceLineEdit(QWidget *parent = 0);
|
|
|
|
protected:
|
|
// int numKeys;
|
|
// int keys[4];
|
|
void keyPressEvent(QKeyEvent *);
|
|
int translateModifiers(Qt::KeyboardModifiers state, const QString &text);
|
|
void resizeEvent(QResizeEvent *);
|
|
|
|
private:
|
|
QToolButton *clearButton;
|
|
QToolButton *acceptButton;
|
|
};
|
|
|
|
class EditShortcutItemDelegate : public QItemDelegate
|
|
{
|
|
Q_OBJECT
|
|
public:
|
|
explicit EditShortcutItemDelegate(QObject *parent = 0);
|
|
|
|
QWidget *createEditor(QWidget *parent, const QStyleOptionViewItem &option,
|
|
const QModelIndex &index) const;
|
|
void setEditorData(QWidget *editor, const QModelIndex &index) const;
|
|
void setModelData(QWidget *editor, QAbstractItemModel *model,
|
|
const QModelIndex &index) const;
|
|
void updateEditorGeometry(QWidget *editor, const QStyleOptionViewItem &option, const QModelIndex &mi) const;
|
|
bool eventFilter(QObject *editor, QEvent *event);
|
|
signals:
|
|
|
|
public slots:
|
|
void closeShortcutEditor();
|
|
};
|
|
|
|
#endif // EDIT_SHORTCUT_ITEM_DELEGATE_H
|