[Qt-creator] closeEditors
Knut Petter Svendsen
knutpett+qtcreator at pvv.org
Mon Dec 4 14:18:16 CET 2023
A singleShot(0) timer did the trick - thanks :)
Now when i open "filename1.cpp" I automatically close the editor with the
singleShot(0) timer and then open "filename2.cpp" with
EditorManager::openEditorAt(). It seems fine until I try to navigate back.
It is then stuck in opening "filename1.cpp" which in turn triggers the
hack again. How can i erase "filename1.cpp" from the history? Or is there
any other better way of doing this?
Knut
> are you doing all these things while "in the stack trace" of the
EM::currentEditorChanged signal?
> Please make sure that you are not changing the EditorManager state in
EM::currentEditorChanged with a direct connection.
> Br, Eike
>> Am 13.09.2023 um 15:40 schrieb Knut Petter Svendsen via Qt-creator
<qt-creator at qt-project.org>:
>> Hi everyone,
>> I'm currently working on a plugin where I aim to achieve the following
functionality:
>> ```
>> Given I open file "filename1.cpp"
>> Then immediately open "filename2.cpp"
>> And close "filename1.cpp" so it is not in the "open documents". ```
>> I have a slot connected to
>> `EditorManager::currentEditorChanged(IEditor*)`. In this slot, I
perform
>> a
>> condition check and subsequently execute `EditorManager::openEditor()`
with the other file, which works smoothly. However, when attempting to
close the first file with
>> EditorManager::closeEditors({EditorManager::currentEditor()}) (not even
opening the second file), I encounter a segfault at
>> `LanguageClient::SemanticTokenSupport::onCurrentEditorChanged`. Why is
this not be functioning as expected, and I wonder if there might be
>> a more effective solution?
>> --
>> Qt-creator mailing list
>> Qt-creator at qt-project.org
>> https://lists.qt-project.org/listinfo/qt-creator
> --
> Eike Ziller
> Principal Software Engineer
> The Qt Company GmbH
> Erich-Thilo-Str. 10
> 12489 Berlin, Germany
> eike.ziller at qt.io
> https://qt.io
> Geschäftsführer: Mika Pälsi,
> Juha Varelius, Jouni Lintunen
> Sitz der Gesellschaft: Berlin, Registergericht: Amtsgericht
> Charlottenburg, HRB 144331 B
More information about the Qt-creator
mailing list