cginternals / libzeug

deprecated: C++ sanctuary for small but powerful and frequently required, stand alone features.
MIT License
16 stars 13 forks source link

Fix signal call order issue in FilePathEditor #158

Closed j-o closed 7 years ago

j-o commented 7 years ago

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.