UI: Defer creation of hotkey dupe icon until needed

This commit is contained in:
derrod 2023-02-22 14:42:31 +01:00 committed by Jim
parent bc9eee922e
commit c3543273e4
2 changed files with 8 additions and 3 deletions

View file

@ -184,7 +184,13 @@ void OBSHotkeyEdit::ClearKey()
void OBSHotkeyEdit::UpdateDuplicationState()
{
if (dupeIcon && dupeIcon->isVisible() != hasDuplicate) {
if (!dupeIcon && !hasDuplicate)
return;
if (!dupeIcon)
CreateDupeIcon();
if (dupeIcon->isVisible() != hasDuplicate) {
dupeIcon->setVisible(hasDuplicate);
update();
}

View file

@ -74,7 +74,6 @@ public:
setAttribute(Qt::WA_InputMethodEnabled, false);
setAttribute(Qt::WA_MacShowFocusRect, true);
InitSignalHandler();
CreateDupeIcon();
ResetKey();
}
OBSHotkeyEdit(QWidget *parent = nullptr)
@ -102,7 +101,7 @@ public:
protected:
OBSSignal layoutChanged;
QAction *dupeIcon;
QAction *dupeIcon = nullptr;
void InitSignalHandler();
void CreateDupeIcon();