Problem: In the source code of QLineEdit, the signal QCompleter::activated is connected directly to QLineEdit::setText to fill the line edit with the activated item text; however, FilePathEditor connects to QCompleter::activated as well, opening a file dialog in case the item Open File Dialog ... is selected and finally calling QLineEdit::setText, too.
The text contained in the line edit depends on the order the slots are called when emitting QCompleter::activated: if the FilePathEditor slot is called first, the file path returned from the file dialog is entered in the line edit, only to be overwritten immediately with Open File Dialog ... when the QLineEdit::setText slot is called subsequently.
Solution: use a QueuedConnection for FilePathEditor::handleItemActivated to defer the call and ensure it is called after QLineEdit::setText.
Problem: In the source code of
QLineEdit
, the signalQCompleter::activated
is connected directly toQLineEdit::setText
to fill the line edit with the activated item text; however,FilePathEditor
connects toQCompleter::activated
as well, opening a file dialog in case the itemOpen File Dialog ...
is selected and finally callingQLineEdit::setText
, too.The text contained in the line edit depends on the order the slots are called when emitting
QCompleter::activated
: if theFilePathEditor
slot is called first, the file path returned from the file dialog is entered in the line edit, only to be overwritten immediately withOpen File Dialog ...
when theQLineEdit::setText
slot is called subsequently.Solution: use a
QueuedConnection
forFilePathEditor::handleItemActivated
to defer the call and ensure it is called afterQLineEdit::setText
.