Bug 406387 - Clicked signal wrongly used as a trigger for activated signal (QTreeWidget, PyQt5)
Summary: Clicked signal wrongly used as a trigger for activated signal (QTreeWidget, P...
Status: CLOSED NOT A BUG
Alias: None
Product: plasma-integration
Classification: Plasma
Component: general (other bugs)
Version First Reported In: 5.15.3
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: Plasma Bugs List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-04-10 05:16 UTC by william.belr
Modified: 2019-04-10 20:04 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed/Implemented In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description william.belr 2019-04-10 05:16:42 UTC
SUMMARY
In QTreeWidget (and perhaps others), the activated signal is usually triggered by a double click, or by pressing enter. Under Plasma KDE, 'clicked' is also used as a trigger. This does not comply with the expected Qt behavior and cause trouble for cross platform applications. 


STEPS TO REPRODUCE
0. Install PyQt5
1. Run this script in a terminal: https://pastebin.com/raw/jfNiiFj6
2. Left click on the 'example item' tree widget item
3. Note the stdout


OBSERVED RESULT (Manjaro-KDE)
pressed
clicked
activated


EXPECTED RESULT (non KDE, Openbox)
pressed
clicked


SOFTWARE/OS VERSIONS
Linux/KDE Plasma: Manjaro
KDE Plasma Version: 5.15.3
KDE Frameworks Version: 5.56.0
Qt Version: 5.12.2 (built against 5.12.1)
Comment 1 David Edmundson 2019-04-10 09:28:15 UTC
>. This does not comply with the expected Qt behavior


From the docs

void QAbstractItemView::activated(const QModelIndex &index)

This signal is emitted when the item specified by index is activated by the user. How to activate items depends on the platform; e.g., by single- or double-clicking the item, or by pressing the Return or Enter key when the item is current.
Comment 2 william.belr 2019-04-10 13:35:10 UTC
The problem is that there are already distinct signals for either click, doubleclick, but none for when Return is pressed on the item. Therefore, it is easy to add a connection to either click or doubleclick if needed, but the only way to add a trigger for Return in this case would be with a keyPressEvent, which is quite a big workaround for a problem that affect a single DE. This is why it is important not to attribute to many signal to activated().
Comment 3 David Edmundson 2019-04-10 20:04:47 UTC
The relevant hint is  QStyle::SH_ItemView_ActivateItemOnSingleClick

Even if we did change our default to suit this one application you're still broken for any other qstyle that sets that hint.  

This is an application bug, not a DE one.

If you think Qt behaviour should be different, please take that up with Qt.