25 #include "kshortcutsdialog_p.h"
29 #include <QGridLayout>
30 #include <QRadioButton>
43 p.drawLine(0, 0, width(), 0);
44 if (qApp->isLeftToRight()) {
45 p.drawLine(0, 0, 0, height());
47 p.drawLine(width(), 0, width(), height());
52 const QKeySequence &activeSeq,
bool allowLetterShortcuts)
53 : TabConnectedWidget(viewport),
54 m_defaultKeySequence(defaultSeq),
60 m_defaultLabel =
new QLabel(
i18nc(
"No shortcut defined",
"None"),
this);
63 defaultText =
i18nc(
"No shortcut defined",
"None");
64 m_defaultLabel->setText(defaultText);
68 m_customEditor->setModifierlessAllowed(allowLetterShortcuts);
76 setKeySequence(activeSeq);
78 connect(m_defaultRadio, SIGNAL(toggled(
bool)),
79 this, SLOT(defaultToggled(
bool)));
80 connect(m_customEditor, SIGNAL(keySequenceChanged(
QKeySequence)),
87 KKeySequenceWidget::ShortcutTypes ShortcutEditWidget::checkForConflictsAgainst()
const
89 return m_customEditor->checkForConflictsAgainst();
93 void ShortcutEditWidget::defaultToggled(
bool checked)
102 if (m_customEditor->isKeySequenceAvailable(m_defaultKeySequence)) {
104 m_customEditor->clearKeySequence();
105 emit keySequenceChanged(m_defaultKeySequence);
109 m_customRadio->setChecked(
true);
115 m_isUpdating =
false;
119 void ShortcutEditWidget::setCheckActionCollections(
123 m_customEditor->setCheckActionCollections(checkActionCollections);
127 void ShortcutEditWidget::setCheckForConflictsAgainst(KKeySequenceWidget::ShortcutTypes types)
129 m_customEditor->setCheckForConflictsAgainst(types);
133 void ShortcutEditWidget::setComponentName(
const QString componentName)
135 m_customEditor->setComponentName(componentName);
139 void ShortcutEditWidget::setMultiKeyShortcutsAllowed(
bool allowed)
142 m_customEditor->setMultiKeyShortcutsAllowed(allowed);
146 bool ShortcutEditWidget::multiKeyShortcutsAllowed()
const
148 return m_customEditor->multiKeyShortcutsAllowed();
152 void ShortcutEditWidget::setCustom(
const QKeySequence &seq)
166 setKeySequence(original);
168 emit keySequenceChanged(original);
169 m_isUpdating =
false;
173 void ShortcutEditWidget::setKeySequence(
const QKeySequence &activeSeq)
175 if (activeSeq == m_defaultLabel->text()) {
176 m_defaultRadio->setChecked(
true);
177 m_customEditor->clearKeySequence();
179 m_customRadio->setChecked(
true);
182 if (activeSeq!=m_customEditor->keySequence()) {
183 m_customEditor->setKeySequence(activeSeq);
QString i18n(const char *text)
QString i18nc(const char *ctxt, const char *text)
QString toString(SequenceFormat format) const
void setColumnStretch(int column, int stretch)
Class to encapsulate user-driven action or event.