Bug 362393

Summary: Middle and right click also trigger selection in kdialog --combobox
Product: [Applications] kdialog Reporter: Antony Lee <anntzer.lee>
Component: generalAssignee: Brad Hards <bradh>
Status: RESOLVED UPSTREAM    
Severity: normal CC: cfeck
Priority: NOR    
Version First Reported In: unspecified   
Target Milestone: ---   
Platform: Arch Linux   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description Antony Lee 2016-04-28 06:10:42 UTC
Middle or right-clicking on a an entry in kdialog --combobox also selects that element, which is rather unexpected.

Reproducible: Always

Steps to Reproduce:
Run
$ kdialog --combobox foo bar
open the combobox and right click on an item.

Actual Results:  
The item is selected.

Expected Results:  
The item is not selected.

The same issue happens when running a PyQt5 GUI (via QCombobox) on KDE.  This makes providing a context menu upon right-clicking on an entry a bit hazardous, as right-clicking on an entry with no associated menu will select it instead.
Comment 1 Christoph Feck 2016-05-05 00:32:25 UTC
Qt comboboxes work this way. If you want it fixed there, please report this issue to the bugtracker of the Qt Project at https://bugreports.qt.io/

For a workaround, see e.g. http://stackoverflow.com/questions/17848119/how-to-let-qcombobox-have-context-menu
Comment 2 Antony Lee 2016-05-05 02:18:06 UTC
This is not true, right-clicking on an item of a Qt combo-box does not select it on Windows (tested by myself).
Reopening the issue.
Comment 3 Christoph Feck 2016-05-05 02:23:17 UTC
But it does on Linux with any Qt application? Here it does. I have no Windows to test.
Comment 4 Christoph Feck 2016-05-05 02:50:11 UTC
I just checked qcombobox.cpp from 5.7 branch, and it does not check which button was used to select the items. See line 709ff at https://code.woboq.org/qt5/qtbase/src/widgets/widgets/qcombobox.cpp.html