diff --git a/src/lib_gui/qt/element/QtCodeFileList.cpp b/src/lib_gui/qt/element/QtCodeFileList.cpp index 1919f236..dfa73144 100644 --- a/src/lib_gui/qt/element/QtCodeFileList.cpp +++ b/src/lib_gui/qt/element/QtCodeFileList.cpp @@ -2,6 +2,7 @@ #include #include +#include #include "utility/file/FilePath.h" #include "utility/utilityApp.h" @@ -219,7 +220,8 @@ void QtCodeFileList::updateFiles() file->updateContent(); } - updateSnippetTitleAndScrollBar(); + // Perform delayed so all widgets are already visible + QTimer::singleShot(100, this, &QtCodeFileList::updateSnippetTitleAndScrollBarSlot); } void QtCodeFileList::showContents() @@ -332,6 +334,11 @@ void QtCodeFileList::resizeEvent(QResizeEvent* event) updateSnippetTitleAndScrollBar(); } +void QtCodeFileList::updateSnippetTitleAndScrollBarSlot() +{ + updateSnippetTitleAndScrollBar(0); +} + void QtCodeFileList::updateSnippetTitleAndScrollBar(int value) { QtCodeFile* firstFile = nullptr; diff --git a/src/lib_gui/qt/element/QtCodeFileList.h b/src/lib_gui/qt/element/QtCodeFileList.h index 073ca74b..a9f482a6 100644 --- a/src/lib_gui/qt/element/QtCodeFileList.h +++ b/src/lib_gui/qt/element/QtCodeFileList.h @@ -58,6 +58,7 @@ protected: virtual void resizeEvent(QResizeEvent* event); private slots: + void updateSnippetTitleAndScrollBarSlot(); void updateSnippetTitleAndScrollBar(int value = 0); void scrollLastSnippet(int value); void scrollLastSnippetScrollBar(int value); diff --git a/src/lib_gui/qt/element/QtCodeFileTitleButton.cpp b/src/lib_gui/qt/element/QtCodeFileTitleButton.cpp index 99130c8f..e1bfa3cd 100644 --- a/src/lib_gui/qt/element/QtCodeFileTitleButton.cpp +++ b/src/lib_gui/qt/element/QtCodeFileTitleButton.cpp @@ -141,7 +141,7 @@ void QtCodeFileTitleButton::updateFromOther(const QtCodeFileTitleButton* other) void QtCodeFileTitleButton::contextMenuEvent(QContextMenuEvent* event) { FilePath path = m_filePath; - if (text().size()) + if (path.empty()) { Project* currentProject = Application::getInstance()->getCurrentProject().get(); if (!currentProject) diff --git a/src/lib_gui/qt/element/QtCodeNavigator.cpp b/src/lib_gui/qt/element/QtCodeNavigator.cpp index 73702591..bee0ec13 100644 --- a/src/lib_gui/qt/element/QtCodeNavigator.cpp +++ b/src/lib_gui/qt/element/QtCodeNavigator.cpp @@ -238,8 +238,7 @@ void QtCodeNavigator::clearCodeSnippets() m_singleHasNewFile = false; - m_screenMatches.clear(); - m_activeScreenMatchId = 0; + clearScreenMatches(); } void QtCodeNavigator::clearFile()