From e0ba7210f36e37df8ee20e9e6684d5da622642d7 Mon Sep 17 00:00:00 2001 From: Le Tan Date: Thu, 6 Jun 2019 20:00:11 +0800 Subject: [PATCH] MdTab: fix bug which will open two tabs for the same file --- src/vmdtab.cpp | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/vmdtab.cpp b/src/vmdtab.cpp index 7aa8bd9c..800a3716 100644 --- a/src/vmdtab.cpp +++ b/src/vmdtab.cpp @@ -94,11 +94,13 @@ VMdTab::VMdTab(VFile *p_file, VEditArea *p_editArea, } }); - if (p_mode == OpenFileMode::Edit) { - showFileEditMode(); - } else { - showFileReadMode(); - } + QTimer::singleShot(50, this, [this, p_mode]() { + if (p_mode == OpenFileMode::Edit) { + showFileEditMode(); + } else { + showFileReadMode(); + } + }); } void VMdTab::setupUI() @@ -940,7 +942,7 @@ void VMdTab::focusChild() break; default: - Q_ASSERT(false); + this->setFocus(); break; } }