15 #include <QDialogButtonBox>
18 #include <QGridLayout>
21 #include <QRadioButton>
22 #include <QVBoxLayout>
24 #include "../../util/btconnect.h"
25 #include "../messagedialog.h"
36 auto *
const vLayout =
new QVBoxLayout(
this);
39 auto gridLayout = std::make_unique<QGridLayout>();
58 vLayout->addLayout(gridLayout.get());
62 auto *
const buttons =
new QDialogButtonBox(QDialogButtonBox::Ok
63 | QDialogButtonBox::Cancel,
66 BT_CONNECT(buttons, &QDialogButtonBox::accepted,
this, &QDialog::accept);
67 BT_CONNECT(buttons, &QDialogButtonBox::rejected,
this, &QDialog::reject);
68 vLayout->addWidget(buttons);
97 int key =
event->key();
98 if ( (key == Qt::Key_Shift) || (key == Qt::Key_Control) || (key == Qt::Key_Meta) || (key == Qt::Key_Alt) )
101 QKeySequence keys(key);
102 QString keyStr = keys.toString();
103 if ( (event->modifiers() & Qt::AltModifier) == Qt::AltModifier)
104 keyStr = QStringLiteral(
"Alt+") + keyStr;
105 if ( (event->modifiers() & Qt::ShiftModifier) == Qt::ShiftModifier)
106 keyStr = QStringLiteral(
"Shift+") + keyStr;
107 if ( (event->modifiers() & Qt::ControlModifier) == Qt::ControlModifier)
108 keyStr = QStringLiteral(
"Ctrl+") + keyStr;
118 auto const keysString(keys.toString());
127 setWindowTitle(tr(
"Configure shortcuts"));
128 auto dialogTooltip = tr(
"Select first or second shortcut and type the "
129 "shortcut with keyboard");
void keyReleaseEvent(QKeyEvent *event) override
QLabel * m_alternateLabel
QRadioButton * m_alternateButton
BtShortcutsDialog(QWidget *parent=nullptr, Qt::WindowFlags f=Qt::WindowFlags())
void changeSelectedShortcut(QKeySequence const &keys)
QRadioButton * m_primaryButton
void keyChangeRequest(QKeySequence const &keys)
void setFirstKeys(const QString &keys)
void setSecondKeys(const QString &keys)
void prepareDialogBox(QDialogButtonBox *box)