/* QAD - Qt ADvanced Ivan Pelipenko peri4ko@yandex.ru, Andrey Bychkov work.a.b@yandex.ru This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this program. If not, see . */ #ifndef SHORTCUTS_H #define SHORTCUTS_H #include "clineedit.h" #include "qad_widgets_export.h" #include class QMainWindow; class ShortcutEdit; class QAD_WIDGETS_EXPORT ShortcutEdit: public CLineEdit { Q_OBJECT friend class Shortcuts; public: explicit ShortcutEdit(QWidget * parent = nullptr); void assignAction(QAction * a); QAction * action() const; bool isEmpty() const; void commit(); void reset(); private slots: void textChangedSlot(QString t); private: void keyPressEvent(QKeyEvent * e) override; QAction * ca; QTreeWidgetItem * ti; }; class QAD_WIDGETS_EXPORT Shortcuts: public QTreeWidget { Q_OBJECT public: explicit Shortcuts(QWidget * parent = nullptr, bool on = true); ~Shortcuts() override; void assignWindow(QWidget * w); void setActive(bool on) { active = on; } QStringList actionTree(QAction * a); static bool checkAction(QAction * a); QList> shortcuts(); public slots: void clear(); void updateShortcuts(); void commit(); void resetShortcuts(); void filter(const QString & what); private: virtual void updateEditorGeometries() override; virtual void changeEvent(QEvent *) override; bool filterTree(QTreeWidgetItem * ti, QString f); QMainWindow * aw; QVector edits; QIcon empty_icon; QFont bfont; bool active; }; #endif // SPINSLIDER_H