31 #include "dynamic-shortcuts/dynamicshortcutswidget.h"
33 #include "dynamic-shortcuts/shortcutcatcher.h"
34 #include "dynamic-shortcuts/shortcutbutton.h"
35 #include "definitions/definitions.h"
37 #include <QGridLayout>
40 #include <QSpacerItem>
46 m_layout =
new QGridLayout(
this);
47 m_layout->setMargin(0);
57 QList<QKeySequence> all_shortcuts;
60 foreach (
const ActionBinding &binding, m_actionBindings) {
61 QKeySequence new_shortcut = binding.second->shortcut();
63 if (!new_shortcut.isEmpty() && all_shortcuts.contains(new_shortcut)) {
68 all_shortcuts.append(binding.second->shortcut());
76 foreach (
const ActionBinding &binding, m_actionBindings) {
77 binding.first->setShortcut(binding.second->shortcut());
82 m_actionBindings.clear();
86 foreach (QAction *action, actions) {
93 QPair<QAction*,ShortcutCatcher*> new_binding;
94 new_binding.first = action;
95 new_binding.second = catcher;
97 m_actionBindings << new_binding;
100 QLabel *action_label =
new QLabel(
this);
101 action_label->setText(action->text().remove(
'&'));
102 action_label->setToolTip(action->toolTip());
103 action_label->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Preferred);
105 QLabel *action_icon =
new QLabel(
this);
106 action_icon->setPixmap(action->icon().pixmap(ICON_SIZE_SETTINGS, ICON_SIZE_SETTINGS));
107 action_icon->setToolTip(action->toolTip());
109 m_layout->addWidget(action_icon, row_id, 0);
110 m_layout->addWidget(action_label, row_id, 1);
111 m_layout->addWidget(catcher, row_id, 2);
117 m_layout->setRowStretch(row_id, 1);
118 m_layout->setColumnStretch(1, 1);
void setDefaultShortcut(const QKeySequence &key)
Sets default shortcut for the widget.
Represents extra widget for changing single keyboard shortcut.