forked from qt-creator/qt-creator
CommandMappings: Do special filtering only for keyboard shortcuts
The view is also used for the regular expressions for FakeVim's ex command mapping, so we should not do special filtering for keyboard shortcuts on OS X Change-Id: I437b45a53beb93caeaec43af2f898c55b2a1601f Reviewed-by: hjk <hjk@theqtcompany.com>
This commit is contained in:
@@ -33,7 +33,6 @@
|
||||
|
||||
#include <coreplugin/dialogs/shortcutsettings.h>
|
||||
|
||||
#include <utils/hostosinfo.h>
|
||||
#include <utils/headerviewstretcher.h>
|
||||
#include <utils/fancylineedit.h>
|
||||
#include <utils/qtcassert.h>
|
||||
@@ -242,22 +241,8 @@ bool CommandMappings::filter(const QString &filterString, QTreeWidgetItem *item)
|
||||
{
|
||||
bool visible = filterString.isEmpty();
|
||||
int columnCount = item->columnCount();
|
||||
for (int i = 0; !visible && i < columnCount; ++i) {
|
||||
QString text = item->text(i);
|
||||
if (HostOsInfo::isMacHost()) {
|
||||
// accept e.g. Cmd+E in the filter. the text shows special fancy characters for Cmd
|
||||
if (i == columnCount - 1) {
|
||||
QKeySequence key = QKeySequence::fromString(text, QKeySequence::NativeText);
|
||||
if (!key.isEmpty()) {
|
||||
text = key.toString(QKeySequence::PortableText);
|
||||
text.replace(QLatin1String("Ctrl"), QLatin1String("Cmd"));
|
||||
text.replace(QLatin1String("Meta"), QLatin1String("Ctrl"));
|
||||
text.replace(QLatin1String("Alt"), QLatin1String("Opt"));
|
||||
}
|
||||
}
|
||||
}
|
||||
visible |= (bool)text.contains(filterString, Qt::CaseInsensitive);
|
||||
}
|
||||
for (int i = 0; !visible && i < columnCount; ++i)
|
||||
visible |= !filterColumn(filterString, item, i);
|
||||
|
||||
int childCount = item->childCount();
|
||||
if (childCount > 0) {
|
||||
@@ -272,6 +257,12 @@ bool CommandMappings::filter(const QString &filterString, QTreeWidgetItem *item)
|
||||
return !visible;
|
||||
}
|
||||
|
||||
bool CommandMappings::filterColumn(const QString &filterString, QTreeWidgetItem *item,
|
||||
int column) const
|
||||
{
|
||||
return !item->text(column).contains(filterString, Qt::CaseInsensitive);
|
||||
}
|
||||
|
||||
void CommandMappings::setModified(QTreeWidgetItem *item , bool modified)
|
||||
{
|
||||
QFont f = item->font(0);
|
||||
|
||||
Reference in New Issue
Block a user