Gui: fix macro command sync in Customize -> Keyboard/Toolbar

This commit is contained in:
Zheng, Lei
2022-03-12 13:38:46 +08:00
committed by wwmayer
parent 028c30e56d
commit 516b60826d

View File

@@ -177,11 +177,18 @@ DlgCustomKeyboardImp::initCommandList(QTreeWidget *commandTreeWidget, QComboBox
populateCommandGroups(combo);
return Application::Instance->commandManager().signalChanged.connect([combo](){
if (combo) {
populateCommandGroups(combo);
combo->activated(combo->currentIndex());
}
// Using a timer to respond for command change for performance, and also
// because macro command may be added before proper initialization (null
// menu text, etc.)
QTimer *timer = new QTimer(combo);
timer->setSingleShot(true);
QObject::connect(timer, &QTimer::timeout, [combo](){
populateCommandGroups(combo);
combo->activated(combo->currentIndex());
});
return Application::Instance->commandManager().signalChanged.connect([timer](){
timer->start(100);
});
}