forked from qt-creator/qt-creator
Override IOptionsPage::matches for ShortcutSettings page
It wasn't finding this page when looking for 'shortcut'.
This commit is contained in:
@@ -39,7 +39,6 @@
|
||||
|
||||
#include <utils/treewidgetcolumnstretcher.h>
|
||||
|
||||
|
||||
#include <QtGui/QKeyEvent>
|
||||
#include <QtGui/QShortcut>
|
||||
#include <QtGui/QHeaderView>
|
||||
@@ -98,10 +97,21 @@ QWidget *ShortcutSettings::createPage(QWidget *parent)
|
||||
m_keyNum = m_key[0] = m_key[1] = m_key[2] = m_key[3] = 0;
|
||||
|
||||
QWidget *w = CommandMappings::createPage(parent);
|
||||
setPageTitle(tr("Keyboard Shortcuts"));
|
||||
setTargetLabelText(tr("Shortcut:"));
|
||||
setTargetEditTitle(tr("Keyboard Shortcuts"));
|
||||
setTargetHeader(tr("Shortcut"));
|
||||
|
||||
const QString pageTitle = tr("Keyboard Shortcuts");
|
||||
const QString targetLabelText = tr("Key sequence:");
|
||||
const QString editTitle = tr("Shortcut");
|
||||
|
||||
setPageTitle(pageTitle);
|
||||
setTargetLabelText(targetLabelText);
|
||||
setTargetEditTitle(editTitle);
|
||||
setTargetHeader(editTitle);
|
||||
|
||||
if (m_searchKeywords.isEmpty()) {
|
||||
QTextStream(&m_searchKeywords) << ' ' << pageTitle
|
||||
<< ' ' << targetLabelText
|
||||
<< ' ' << editTitle;
|
||||
}
|
||||
|
||||
return w;
|
||||
}
|
||||
@@ -120,6 +130,11 @@ void ShortcutSettings::finish()
|
||||
CommandMappings::finish();
|
||||
}
|
||||
|
||||
bool ShortcutSettings::matches(const QString &s) const
|
||||
{
|
||||
return m_searchKeywords.contains(s, Qt::CaseInsensitive);
|
||||
}
|
||||
|
||||
bool ShortcutSettings::eventFilter(QObject *o, QEvent *e)
|
||||
{
|
||||
Q_UNUSED(o)
|
||||
@@ -369,7 +384,7 @@ void ShortcutSettings::markPossibleCollisions(ShortcutItem *item)
|
||||
continue;
|
||||
}
|
||||
|
||||
foreach(int context, currentItem->m_cmd->context()) {
|
||||
foreach (int context, currentItem->m_cmd->context()) {
|
||||
|
||||
// conflict if context is identical, OR if one
|
||||
// of the contexts is the global context
|
||||
|
||||
@@ -73,6 +73,7 @@ public:
|
||||
QWidget *createPage(QWidget *parent);
|
||||
void apply();
|
||||
void finish();
|
||||
bool matches(const QString &s) const;
|
||||
|
||||
protected:
|
||||
bool eventFilter(QObject *o, QEvent *e);
|
||||
@@ -97,6 +98,8 @@ private:
|
||||
|
||||
QList<ShortcutItem *> m_scitems;
|
||||
int m_key[4], m_keyNum;
|
||||
|
||||
QString m_searchKeywords;
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
|
||||
Reference in New Issue
Block a user