未验证 提交 8e53932a 编写于 作者: J Jim 提交者: GitHub

Merge pull request #1406 from VodBox/hotkey-search

UI: Add Search to Hotkeys settings menu
......@@ -773,6 +773,7 @@ Basic.AdvAudio.AudioTracks="Tracks"
# basic mode 'hotkeys' settings
Basic.Settings.Hotkeys="Hotkeys"
Basic.Settings.Hotkeys.Pair="Key combinations shared with '%1' act as toggles"
Basic.Settings.Hotkeys.Filter="Filter"
# basic mode hotkeys
Basic.Hotkeys.SelectScene="Switch to scene"
......
......@@ -2423,6 +2423,47 @@ void OBSBasicSettings::LoadHotkeySettings(obs_hotkey_id ignoreKey)
widget->setLayout(layout);
ui->hotkeyPage->setWidget(widget);
auto filterLayout = new QGridLayout();
auto filterWidget = new QWidget();
filterWidget->setLayout(filterLayout);
auto filterLabel = new QLabel(QTStr("Basic.Settings.Hotkeys.Filter"));
auto filter = new QLineEdit();
auto setRowVisible = [=](int row, bool visible, QLayoutItem *label) {
label->widget()->setVisible(visible);
auto field = layout->itemAt(row, QFormLayout::FieldRole);
if (field)
field->widget()->setVisible(visible);
};
auto searchFunction = [=](const QString &text) {
for (int i = 0; i < layout->rowCount(); i++) {
auto label = layout->itemAt(i, QFormLayout::LabelRole);
if (label) {
OBSHotkeyLabel *item =
qobject_cast<OBSHotkeyLabel*>(
label->widget());
if(item) {
if (item->text().toLower()
.contains(text.toLower()))
setRowVisible(i, true, label);
else
setRowVisible(i, false, label);
}
}
}
};
connect(filter, &QLineEdit::textChanged,
this, searchFunction);
filterLayout->addWidget(filterLabel, 0, 0);
filterLayout->addWidget(filter, 0, 1);
layout->addRow(filterWidget);
using namespace std;
using encoders_elem_t =
tuple<OBSEncoder, QPointer<QLabel>, QPointer<QWidget>>;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册